1

I've been working in a branch that has many commits. Once pushed and merged to 'master', what's the best option to revert changes all merged commits from the branch i was working in 'master'?

What about this?

git revert -m 1 <merge-commit>
1
  • 2
    HAve you pushed the commits or are they still lying locally? Commented Jan 3, 2017 at 17:08

1 Answer 1

2

The best way to do this is by first merging your branch in using the --no-ff option.

git merge --no-ff your-dev-branch

What this does is create whats called a merge commit for you. If you want to revert the merge, you only have to revert that merge commit. If you don't specify the --no-ff flag, then there may be a chance that it doesn't create the merge commit.

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