Created
June 29, 2015 17:37
-
-
Save ianthekid/ea34cc4fd8b908733192 to your computer and use it in GitHub Desktop.
git fetch and rebase
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
git fetch | |
git rebase origin/master | |
#Source: http://stackoverflow.com/questions/7200614/how-to-merge-remote-master-to-local-branch | |
#git merge branchname takes new commits from the branch branchname, and adds them to the current branch. If necessary, it automatically adds a "Merge" commit on top. | |
#git rebase branchname takes new commits from the branch branchname, and inserts them "under" your changes. More precisely, it modifies the history of the current branch such that it is based on the tip of branchname, with any changes you made on top of that. | |
#git pull is basically the same as git fetch; git merge origin/master. | |
#git pull --rebase is basically the same as git fetch; git rebase origin/master. | |
#So why would you want to use git pull --rebase rather than git pull? Here's a simple example: | |
#You start working on a new feature. By the time you're ready to push your changes, several commits have been pushed by other developers. | |
#If you git pull (which uses merge), your changes will be buried by the new commits, in addition to an automatically-created merge commit. | |
#If you git pull --rebase instead, git will fast forward your master to upstream's, then apply your changes on top. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment