Created
July 8, 2016 11:06
-
-
Save addicteduser/6f8e7be9f94f16c0e3c543c4e04102ab to your computer and use it in GitHub Desktop.
Git commands
This file contains 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
Rename git branch locally and remotely | |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote | |
. : Sync Fork with Main Repository : . | |
1. git fetch upstream | |
2. git merge upstream/master | |
3. git push origin master | |
. : Fetch Updates Made to a Remote Repository : . | |
(i.e. updates made by others) | |
1. git fetch [remote name] | |
. : Merge Updates Made Online with Local : . | |
1. git merge [remote name]/[branch name] | |
--- to cancel: git merge --abort | |
. : Fetch and Merge Shortcut : . | |
1. git pull [remotename] [branchname] | |
. : Fix .gitignore : . | |
1. First commit all your changes | |
2. git rm -r --cached . | |
3. git add . | |
4. git commit -m "Fixed .gitignore" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment