0
master branch feature branch: created from master branch dev branch: created from feature branch 

I merged dev branch to feature branch by mistake, now I have to roll back feature branch. So how can I do that?

1 Answer 1

1

If you just did the merge (of dev to feature), you could "Undo a Git merge that hasn't been pushed yet" with a git reset, especially if you have not pushed the feature branch yet.

git switch feature git reset --hard HEAD~1 

Make sure you don't have any work in progress.
And check with git log --decorate --oneline --graph --branches that your feature branch history is indeed showing the merge commit as the most recent one.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.