Friday, November 8, 2013

git re-merge done easy

I messed up some files during a larger merge a couple of days ago. When I tracked down the files that had issues (in my case the unit tests didn't succeed anymore), I wondered if there is an easy way to revert to the version of the file before the merge and redo the merge or at least bring back the file with the conflict markers.

I was looking for an elegant solution. Something must exist that helps engineers to easily resolve situations like this.
After 45 seconds of research (sometimes it's that quick if you know the right words to search for), this result on StackOverflow came up.
git checkout -m <filename>

Very nice solution. I was able to go back to the state, where the file contained all the conflict markers and I was able to resolve the issue pretty quickly.

Yes, sometimes git is really easy.