3

I've attached an image to illustrate my question.

In Commit C hundreds of files were added. In Commit D a few files were added. When D tried to merge back to develop there was a merge conflict. The developer that resolved the conflict did so by deleting everything that was added in C. After which, several commits were added before it was realized.

Now I'm trying to get additions from C back into the stream. But simply merging C to develop won't work because the git history shows the files in C were deleted in D.

enter image description here

I don't know how to resolve this issue without combing through the files in C, adding them to a new branch, and creating a PR for that branch (which would be painful, there are hundreds of files).

Also, force-pushing is unavailable. We could get them temporarily, but the bureaucratic powers at be would have to get involved so I'm trying to avoid that if possible.

Does anyone know how to navigate this gitastrophy?

micah
  • 7,596
  • 10
  • 49
  • 90
  • if its not too much commits after d i would just extract them as patches branch fresh of c and reapply everything clean – Kai Iskratsch Mar 14 '16 at 15:47
  • 1
    I would start by firing whoever did this in the first place. I know it doesn't help answer your question, but it may help you feel better... – Software Engineer Mar 14 '16 at 16:01

1 Answers1

0

maybe clone the repo and try git cherry-pick <hash for c>

That should try to add all the files that were added in commit C. It will probably give you a conflict and not commit anything. Then you can look through conflicts, and hopefully figure out what to commit.

or if you just want to get to where you were right after you committed c or d but with a few extra commits, something like this:

git clone <url> #start with a fresh clone in case you mess it up more
git checkout <hash for d>
git reset master #if E is master
git add -A
git commit -m"get back to where we were after d"
Alex028502
  • 3,486
  • 2
  • 23
  • 50