Better git conflict resolution between binaries with --theirs and --ours

Posted by on February 24, 2009
Whichever framework I use ("Catalyst":http://www.catalystframework.org, "Django":http://www.djangoproject.com, etc.) for personal projects, I always develop with a local "SQLite":sqlite database. From time to time they can get out of sync between branches. While working on a project recently, I ran into a "Git":git conflict between a "SQLite":sqlite database on @master@ and an older copy on a development branch. After checking out the development branch, I ran the merge:
 $ git checkout dev_branch
 $ git merge master
"Git":git notified me that I had a conflicting "SQLite":sqlite file. I posed the question on the "Git":git irc channel and was told (thanks doener) to use the @--theirs@ flag for @git checkout@.
 $ git checkout --theirs filename(s)
This says that the file(s) being merged in take precedence over the file(s) in place in the branch, thus running this will overwrite the file(s) on the branch. @--ours@ is the opposite in that the file(s) on the branch take precedence in this merge. More information can be found in the "git-checkout docs":http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html. I was then able to complete the merge:
 $ git add umerged_file(s)
 $ git commit
I'm not sure which version of "Git":git this was made available in, but having just upgraded for this feature it is available in the latest stable version (currently "1.6.1.3":http://www.kernel.org/pub/software/scm/git/git-1.6.1.3.tar.bz2). In the old version I was running (1.6.0.2) @"git reset -- file; git checkout MERGE_HEAD -- file"@ would have done the same. [git]http://www.git-scm.org [sqlite]http://www.sqlite.org