简体   繁体   English

回滚以开发没有最后合并功能的分支

[英]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分支):

  1. 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 2git revert表示您将创建一个还原提交,而develop表示您的还原目标是您的develop分支指向的位置, -m 2表示您正在还原一个合并提交,并且您打算从合并的第二个父级还原更改。

  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.

相关问题 使用SmartGit将功能分支合并到开发中 - merge feature branch into the develop with SmartGit Git 将开发分支上的功能合并到另一个已经存在的开发分支 - Git merge feature on develop branch to another already existing develop branch GitFlow:安全地将开发更改合并到功能分支 - GitFlow: safely merge develop changes to a feature branch 如何自动进行功能分支合并以进行开发? - How to automate feature branch merge on to develop? Git:master/develop/feature 分支合并提交 - Git: master / develop / feature branch merge commits 将开发分支合并到主分支而不关闭开发 - Merge develop branch into master branch without closing develop 在功能分支合并之前回滚 git 主分支,做一些工作并再次合并功能分支 - Rollback git main branch prior to feature branch merge, do some work and merge the feature branch back again 如何将develop分支中的git提交合并到一个功能分支 - How to merge git commits in the develop branch to a feature branch GIT merge develop into feature branch -- 同一个分支被合并和恢复后 - GIT merge develop into feature branch -- after the same branch was merged and reverted GitFlow 功能完成不会将功能分支合并到开发中 - GitFlow feature finish does not merge the feature branch into develop
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM