假设我在Git中有两个分支:development和qa-test。这两个分支都包含不同的特性-提交,但A也是这两个分支的最新共同祖先:
A--->B--->C--->developent
\
\
D--->E--->qa-test在某种程度上,我们发现A中有一个bug,我们需要在qa-test和development中修复它们,也就是说,我们需要修复它们。我可以使用的方法之一是从qa-test names hotfix创建一个新分支,修复那里的bug,提交到qa-test中,然后再将它插入development。有更好的方法吗?
发布于 2013-09-19 13:42:15
从A创建分支,然后合并with qa-test和development的更改。
$ git merge-base qa-test development
sha-1 A
$ git checkout -b hotfix <<sha-1 A>>
... do changes and commits
$ git checkout devel
$ git merge hotfix
$ git checkout qa-test
$ git merge hotfix
$ git branch -d hotfix 发布于 2018-01-19 22:28:34
扩展@Konstantin的回答:
$ git checkout A
... fix bugs ...
$ git checkout -b fix # creates a temporary branch for the fix
$ git commit国家现在:
fix
/
A -> B -> C -> development
\
D -> E -> qa-test现在是重新基地:
$ git checkout development
$ git rebase fix # uproot development and stick it on the fix branch
... fix any merge conflicts ...
$ git checkout qa-test
$ git rebase fix # same for qa-test
... fix any merge conflicts ...国家现在:
A -> fix -> B -> C -> development
\
D -> E -> qa-test,如果我在这里做了什么可怕的错误,请告诉我,这样我就能解决这个问题!
发布于 2013-09-19 13:34:17
"重基“将为您完成这一任务,修复开发分支中的bug,然后将qa-test与开发重新定位。
https://stackoverflow.com/questions/18896050
复制相似问题