这是我经常遇到的一个常见的工作流程障碍:
master是我们的“稳定”分支
$ git status
# On branch master
nothing to commit (working directory clean)
在分支上创建模块
$ git checkout -b foo
$ echo "hello" > world
$ git add .
$ git commit -m "init commit for foo module"
$ git checkout master
$ git merge foo
在 master 或其他分支上工作
在接下来的几周内,更多的代码将直接提交给 master 并由其他分支提交。分支在foo
这段时间内将保持不变。
在foo分支上恢复工作/进行更新
$ git checkout foo
不好了!foo已经过时了!我明白为什么,但我确实需要foo重新同步。
问题
如何从master分支获取最新内容?