Here's a common workflow hurdle I encounter often:
master is our "stable" branch
$ git status
# On branch master
nothing to commit (working directory clean)
Create a module on a branch
$ git checkout -b foo
$ echo "hello" > world
$ git add .
$ git commit -m "init commit for foo module"
$ git checkout master
$ git merge foo
Do work on master or other branches
Over the next couple weeks, more code will be committed to master directly and by other branches. The foo
branch will go untouched for this time period.
Resume work/make updates on the foo branch
$ git checkout foo
Oh no! foo is massively out of date! I understand why, but I do need foo back in sync.
The question
How do I get the latest contents from the master branch?
foo
branch while I make quick changes on abugfix
branch.bugfix
will be merged intomaster
, but then it should be sync'd withfoo
afterward, too. Does that make sense? – Anaplasty