Monday, January 30, 2012

git merge mess

Better branch handling would be best but I ran into a little merge problem with stuff I do at work. I've started making a major rewrite of parts, that work is going on in the master branch, still a lot to do so no way to run that yet in production. So of course a have a stable branch for production use and need to do some fixing there from time to time. Those changes of course need to go into the master branch too. But as these fixes are branches from the stable branch and master is going trough a rewrite there are plenty of merge conflicts in some files, that are not relevant in any way to the changes made.

I first tried the obvious, "checkout the current branches files for these":

git checkout file1 file2 file3

No, that didn't work:
error: path 'file1' is unmerged
error: path 'file2' is unmerged
error: path 'file3' is unmerged

Well, yeah I know that and I Don't Care, checkout the files ¤!#"f*!!%"# stupid git!

After googling around I finally found the solution in this old post.

git checkout HEAD file1 file2 file3

Yay!