0

I need some hints to do a revert of a revert to be able to continue with my work. I was in a middle of a feature when suddenly I needed to launch the website before being able to finish it. I did several reverts on commits related to that feature that now I need to recover.

What is the most smoothly way to do this? It's fine to create a patch from several commits and then resolve the conflicts?

Opal
  • 81,889
  • 28
  • 189
  • 210
Andre Garcia
  • 894
  • 11
  • 30

1 Answers1

1

This doesn't solve your problem directly, but you could have used a branch from an earlier commit to do the release without reverting anything.

You could also go back and rebase the revert commits in order to drop them from history, but that's probably not a good idea if you have other developers or branches.

You could also just use the same revert command to do a revert of each of the reverts. If you want to make a single revert that combines all of the double reverts, you can then use rebase to squash them all together.

The git revert command supports a list of commits, so you can give them all at once in a single command invocation. Also, if the reverts are all sequential, you can specify a commit range.

b4hand
  • 9,550
  • 4
  • 44
  • 49
  • I do have some other colleagues working on the branch im currently on. I need some extra caution! :) We are talking about 13 commits. I was doing a revert for each revert but in the middle i lost track of it and blew the all thing. What do you suggest? – Andre Garcia Apr 28 '15 at 16:27
  • I updated my answer to include help with the large number of commits. Hopefully, the commits are not separated from each other. – b4hand Apr 29 '15 at 02:13
  • 1
    Also: make a list of the commits that need to be reverted before doing anything. You can get a list of all the reverts in the last 100 commits by using `git log --grep="Revert" HEAD~100`. – dshepherd May 01 '15 at 08:00