[英]rollback to develop branch without last merge feature
I made a mistake merging my last feature with develop; 我将自己的最后一个功能与developerWorks合并时出错了; I had just to finish my feature and then do a PR, and then merge trought github. 我只需要完成功能,然后进行PR,然后合并trought github。
What is the right method to go back to before I merge my last feature ? 在合并我的上一个功能之前可以使用的正确方法是什么?
I'm confused about when do 'git push', and really with a PR , I don't must use anymore git finish feature, not ? 我对何时执行“ git push”感到困惑,并且确实使用PR时,我不必再使用git finish功能,不是吗? because this last merge, and I need to do PR to pass circle tests. 因为这是最后一次合并,所以我需要进行PR才能通过圈子测试。
can I delete my remote branch (because i have a local with the same name)? 我可以删除我的远程分支(因为我有一个同名的本地分支)吗? before do push? 之前要推吗? that is better? 那比较好? in case of conflicts with the remote? 如果与遥控器发生冲突?
These are non-github solutions that can undo code changes from merge, which can be done in terminal(assuming you've checked out develop
branch): 这些是非github解决方案,可以撤消合并中的代码更改,可以在终端中完成(假设您已经签出了develop
分支):
git revert develop -m 2
and then git push
. git revert develop -m 2
,然后git push
。
git revert develop -m 2
: git revert
means you're going to create a revert commit, and develop
means your revert target is where your develop branch is pointing to, and -m 2
means you're reverting a merge commit and you intend to revert change from second parent of merge. git revert develop -m 2
: git revert
表示您将创建一个还原提交,而develop
表示您的还原目标是您的develop分支指向的位置, -m 2
表示您正在还原一个合并提交,并且您打算从合并的第二个父级还原更改。
git reset develop^1 --hard
, and then git reset origin/develop --mixed
, and then git commit
(with messages like "Revert merge.") git reset develop^1 --hard
git reset origin/develop --mixed
git reset develop^1 --hard
,然后git reset origin/develop --mixed
,然后git commit
(带有诸如“ Revert merge”之类的消息)。
git reset develop^1 --hard
means you're resetting HEAD
& filesystem status to first parent of develop
. git reset develop^1 --hard
意味着你重置HEAD
&文件系统的状态来的第一个父develop
。 So after this, your filesystem should not include changes from develop
branch. 因此,在此之后,您的文件系统不应包含来自develop
分支的更改。
git reset origin/develop --mixed
means you're resetting HEAD
into origin/develop
, but preserve filesystem changes and add all into staged area. git reset origin/develop --mixed
意味着您将HEAD
重置为origin/develop
,但保留文件系统更改并将所有内容添加到暂存区域。 So after this, your filesystem should be exactly same to what it was before merge, and ready to commit. 因此,此后,您的文件系统应与合并之前的文件系统完全相同,并准备提交。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.