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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.