"git pull" or "git merge" between master and development branches

Carson picture Carson · Dec 29, 2010 · Viewed 160.8k times · Source

I have my master branch and a develop branch for working on a few changes. I need to merge changes from master into develop, but will eventually merge everything from develop into master. I have two different workflows in mind:

  1. git pull origin master into develop branch
  2. git merge master into develop branch

Which is the best way to do this, and why?

Answer

Ian Lotinsky picture Ian Lotinsky · Dec 29, 2010

This workflow works best for me:

git checkout -b develop

...make some changes...

...notice master has been updated...

...commit changes to develop...

git checkout master
git pull

...bring those changes back into develop...

git checkout develop
git rebase master

...make some more changes...

...commit them to develop...

...merge them into master...

git checkout master
git pull
git merge develop