1

I merged 6 PRs into master and someone reverted them all. Now I need to re-submit them as pull requests.

I thought I could use git revert <revert_commit_sha>. This actually does work for the newest of the revert commits. However when I try and revert the previous revert commit, it says:

nothing to commit, working tree clean

As a workaround I tried to use git cherry-pick <original_commit_sha> as advised from how-do-i-un-revert-a-reverted-git-commit, but I see this:

nothing to commit, working tree clean The previous cherry-pick is now empty, possibly due to conflict resolution.

Not sure what I should do, and why this revert is not working while the first one I tried did work.

I also tried the following steps:

  1. reset --hard to the original commit
  2. (soft) reset to the commit before this point, so the changes are unstaged
  3. stash the changes
  4. reset --hard the branch to master state
  5. stash apply

However it says this message again when I try and stash apply:

nothing to commit, working tree clean

max pleaner
  • 26,189
  • 9
  • 66
  • 118
  • You may want to try reverting one commit at a time, so if you have 6 commits, start your way working through the oldest -> newest – Pankaj Gadge Dec 01 '17 at 21:54
  • @helloworld Ok. I was trying newest => oldest. Worth trying anything. – max pleaner Dec 01 '17 at 21:55
  • @helloworld but how can I have each revert-revert be its own branch if i'm doing it incrementally like this? – max pleaner Dec 01 '17 at 21:56
  • If you have the newest commit hash, you can directly reset on it i.e. `git reset --hard ` and then push `git push origin master` – Pankaj Gadge Dec 01 '17 at 21:56
  • Newest-to-oldest is the correct order in general. I think the reason you have no answers yet—certainly it's why *I* haven't answered—is that you have not shown us precisely what's going wrong. Depending on the nature of the problem, a `script` session in Linux might suffice, or we might even need access to the repository in question. – torek Dec 02 '17 at 19:13
  • @torek unfortunately this is a private repo for work, and I haven't achieved much communication with the person who did the reverts. I actually have managed to make some progress on this, by making new branches based off master and merging in the original branches that were reverted. I haven't tried merging any of these new branches into master yet, though, because I'm still fixing unit tests. – max pleaner Dec 02 '17 at 19:26

0 Answers0