如何撤消 git flow 功能完成?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13450039/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:46:16  来源:igfitidea点击:

How to undo git flow feature finish?

gitgit-branchbranching-and-merginggit-flow

提问by hakunin

I am learning git-flow and I just did git flow feature finish <feature-name>, which merged my feature branch to develop and removed it.

我正在学习 git-flow 并且我刚刚做了git flow feature finish <feature-name>,它合并了我的功能分支来开发并删除它。

Instead of this, I want to push the feature branch to github, so I can merge it after a peer review.

而不是这样,我想将功能分支推送到 github,以便我可以在同行评审后合并它。

So the question is, how do I 'undo' this command. Or in other words , how can I move my last two commits from develop to my feature branch?

所以问题是,我如何“撤消”这个命令。或者换句话说,我如何将我的最后两个提交从 develop 移动到我的功能分支?

回答by Peter van der Does

These steps should do the trick:

这些步骤应该可以解决问题:

Get the sha's needed:

获取需要的 sha:

git log

<sha1>is the commit right before the merge
<sha2>is the last commit on develop before you started working on the feature

<sha1>是合并之前的提交
<sha2>是您开始处理该功能之前开发的最后一次提交

git checkout develop
git checkout -b feature/<feature-name>
git reset <sha1> --hard
git checkout develop
git reset <sha2> --hard

Push your feature branch.

推送您的功能分支。