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
  • 32,079
  • 16
  • 104
  • 187
Mitch VanDuyn
  • 2,838
  • 1
  • 22
  • 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
  • 42,571
  • 24
  • 140
  • 158
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
  • 124,556
  • 26
  • 146
  • 141