Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
systems:git_setup_and_configuration [2018/06/15 13:10]
smayr [Git Flow]
systems:git_setup_and_configuration [2018/06/18 14:39] (current)
smayr [Synchronize Changes]
Line 208: Line 208:
   $ git pull                       # Downloads bookmark history and incorporates changes     $ git pull                       # Downloads bookmark history and incorporates changes  
      
 +**Fetch vs. Pull:** Do a ''git fetch'' at any time to update your remote-tracking branches under ''refs/remotes/<remote>/''. This operation never changes any of your own local branches under ''refs/heads'' A ''git pull'' is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.
 +
 +Basically a ''git pull'' is a ''git fetch'' + ''git merge FETCH_HEAD'', but the latter allows time to review changes before the merge (the former does the merge automatically, which sometimes can be disastrous). 
 +
 +Therefore, instead of a ''git pull'', using ''git fetch; git reset --hard origin/master'' is a safe method to add to your workflow. It eliminates local changes, keeps you up to date with master, but ensure new changes do not get pulled in on top on current changes and make a mess. It is a safer practice. Just be sure to add/commit/stash any work-in-progress first.
 +
 +See: 
 +  * [[https://stackoverflow.com/questions/292357/what-is-the-difference-between-git-pull-and-git-fetch|Difference between git pull and git fetch]]
 +  * [[https://longair.net/blog/2009/04/16/git-fetch-and-merge/|Git: Fetch and Merge, Don't Pull]]
 +
 +Get any changes in the remote branch since the last pull:
 +  $ git fetch
 +  $ git diff ...origin (or $ git diff origin/master)
 === Merge or Rebase === === Merge or Rebase ===
 Merge the ''master'' to the ''feature'' branch: Merge the ''master'' to the ''feature'' branch:
Line 289: Line 302:
 Organizing your repository to use git flow. Organizing your repository to use git flow.
 {{ :systems:git-model_2x.png?600 |}} {{ :systems:git-model_2x.png?600 |}}
-Author: Vincent Driessen +Author: Vincent Driessen | 
-Original blog post: http://nvie.com/posts/a-succesful-git-branching-model+Original blog post: http://nvie.com/posts/a-succesful-git-branching-model |
 License: Creative Commons BY-SA License: Creative Commons BY-SA