Git-Flow撤消完成的功能分支 [英] Git-Flow undo a finished feature branch
问题描述
如果要撤消"功能分支,可以使用哪些选项?假设您添加了一个新功能supercool-feature
,然后将其完成(合并到开发中并删除功能分支),然后将其发布.但是您的用户真的不喜欢这个supercool-feature
.如何撤消/倒退/撤消已经合并到开发和发行中的此功能?
What options do you have if you want to "undo" a feature branch? Let's say you add a new feature supercool-feature
which you finish (merge into development and delete the feature branch) and then it goes into a release. But then your users really dislike this supercool-feature
. How can I undo/rewind/reverse this feature which has been already merged into development and a release?
我正在使用SourceTree进行版本控制.
I'm using SourceTree to do my versioning.
推荐答案
运行此命令
git revert -m 1 <sha1 of M>
说明
您的情况如下:
A-B-----C---D-M # master
\ /
X-Y---Z- # supercool-feature
A,B,C和D在您的主分支中,X,Y和Z在您的功能分支中.当您完成git merge supercool-feature
时,Git为您创建了一个合并提交"M.此提交包含来自功能部件分支的所有提交以及可能修复合并冲突的修补程序.因此,如果您revert
一次提交,功能分支中的所有更改都将再次消失.
A, B, C and D were in your master branch, X, Y and Z in your feature branch. When you did git merge supercool-feature
Git created a "merge commit" M for you. This commit encloses all commits from your feature branch as well as possible fixes to fix merge conflicts. So if you revert
that one commit, every change from your featurebranch will be gone again.
这篇关于Git-Flow撤消完成的功能分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!