我想“同步”一个远程分支与头部,这样,当我最终合并,它不会是一个头痛。因此,我想试着把头转到我的树枝上,看看它有多不同。
如何在Git中完成以下工作流?
在一个更好的工作流上完成相同任务的任何提示都是非常有用的。
发布于 2012-01-11 19:24:16
这些都是非常基本的东西:
# make sure your notion of the remote is up to date
git fetch origin
# create and check out a branch, at the same place as the remote master branch
git checkout -b origin-master origin/master
# merge your local master
git merge master
# test, edit away, hack hack hack
git add ...
git commit ...
# push back to origin
git push origin origin-master:master术语说明:
至于你关于更好的工作流来做同样的事情的问题.很难回答。你的目标有点模糊。你说“慢慢地”同步,并提到“最终合并它”,但是你所勾勒的步骤是一次完成的,所以.嗯,都合并了。以后没什么可做的。如果您想要增量地执行,您可以简单地重复我给出的步骤,选择历史中的中间提交来合并每次。这也有点不清楚,你想要合并的方向。也许你真的想从你的分支开始,把远程的东西整合进去?
git checkout -b master-merging master
git fetch origin
git merge origin/master
# test, hack, commit, push...
git push origin master-merging:master或与增量合并:
git checkout -b master-merging master
git fetch origin
git merge origin/master~20 # 20 commits before origin/master
# test, hack, commit
git merge origin/master~10 # 10 commits before origin/master
# test, hack, commit
git merge origin/master
# test, hack, commit, push...https://stackoverflow.com/questions/8825204
复制相似问题