简体   繁体   中英

rollback to develop branch without last merge feature

I made a mistake merging my last feature with develop; I had just to finish my feature and then do a PR, and then merge 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 ? because this last merge, and I need to do PR to pass circle tests.

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):

  1. git revert develop -m 2 and then 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.

  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 means you're resetting HEAD & filesystem status to first parent of develop . So after this, your filesystem should not include changes from develop branch.

    git reset origin/develop --mixed means you're resetting HEAD into origin/develop , but preserve filesystem changes and add all into staged area. So after this, your filesystem should be exactly same to what it was before merge, and ready to commit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM