Last active
November 28, 2016 11:21
-
-
Save vaibhaw/5f7536b79341090fb009 to your computer and use it in GitHub Desktop.
Common git commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## check url of git-repo | |
| git remote -v | |
| ## change url of git-repo | |
| git remote set-url origin <new-git-repo-url> | |
| ## colorize git output | |
| # source: http://unix.stackexchange.com/a/44297/62741 | |
| # source: http://stackoverflow.com/a/13075208/925216 | |
| git config --global color.ui auto | |
| ## If 2FA is set in github, you have to generate an access token | |
| # and change protocol from https to git to access your repository | |
| # check remote url | |
| git remote -v | |
| # remove existing remote origin and add remote again | |
| git remote rm origin | |
| git remote add origin git@github.com:user/repo.git # OR | |
| # change url of git-repo | |
| git remote set-url origin <new-git-repo-url> | |
| ## change commit message in git | |
| # source: http://stackoverflow.com/questions/179123 | |
| git commit --amend -m "New commit message" | |
| ## git submodules | |
| https://chrisjean.com/git-submodules-adding-using-removing-and-updating/ | |
| ## add previously added files and commit them | |
| git commit -a -m "message" | |
| ## git branch | |
| git checkout -b <branch_name> | |
| git push origin <branch_name> | |
| ## fetch a branch from remote | |
| git fetch | |
| git checkout branch_name | |
| https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment