1

I have a branch on my local machine that has a complex history going back several months with many commits and merges with master.

I now want to merge this branch into master, deploy it, but if necessary in the future be able to do a single revert to undo the merge on to master. For example I merge today, but then a week later (after other commits for other features have been done) we discover we have to undo this merge.

Is it as simple as doing a revert using the sha from the merge?

Robin Green
  • 30,802
  • 16
  • 100
  • 180
Mitch VanDuyn
  • 2,684
  • 1
  • 18
  • 29

2 Answers2

0

Yes doing a git revert on the merge commit should reverse the effects of the merge.

If you wait a week you may of course have to resolve conflicts with other changes that have occurred. After resolving them you can git revert --continue

Klas Mellbourn
  • 39,060
  • 21
  • 132
  • 151
0

Yes, but you should revise your workflow and only use master for what is deployed. Google "branch per feature" You should find my post.

Adam Dymitruk
  • 117,004
  • 25
  • 140
  • 137