This contains all the necessary CMD line commands to execute and add new repositories in github.
- Adding new project
- changing user name
- global initialization of usernames
- Renaming branch
- Adding to remote repo in github
-
GIT ORIGIN
- ADD ORIGIN URL
git remote add origin <github-url>- REMOVE ORIGIN URL
git remote rm origin- VIEW ORIGIN URL
git remote -v- RENAMING ORIGIN URL
git remote set-url origin <new-url> -
GIT PROCEDURE:
- ADD Files to staging
git add .- COMMIT the changes
git commit -m "init"- PUSH the changes to GITHUB
git push origin master -
VIEW GITHUB CREDENTIALS
- VIEW GIT USER and EMAIL credentials
git config --global --list -
CHANGE GITHUB CREDENTIALS
- CHANGE USERNAME
git config user.name <name>- CHANGE EMAIL
git config user.email <email> -
TODO If you want to change the username and user email for the individual project
- Change the email
git config user.email <email-id>- Change the username
- git config credential.username <user-id>- NOTE:
- Changing the name, whether name contains spaces or not
git config user.name "<if name with spaces>"git config user.name <if name contains no spaces>
-
RENAME BRANCH
- Renaming the branch
git branch -m <oldname> <newname> -
LOG HISTROY
- To view the history of commits
git log -
FORCE RESET DO it after the
git pull origin master, to forcefully make it same as the remote branchgit reset --hard origin/master -
RESET to a previous COMMIT
git reset <commithash> -
FOURCE UPDATE
git push origin <branchName> --force