When applying a patch is there any way to resolve conflicts?
To generate your patch do the following:
git format-patch --stdout first_commit^..last_commit > changes.patch
Now when you are ready to apply the patches:
git am -3 < changes.patch
the -3
will do a three-way merge if there are conflicts. At this point you can do a git mergetool
if you want to go to a gui or just manually merge the files using vim (the standard <<<<<<
, ||||||
, >>>>>>
conflict resolution).
If you are frequently running into the same conflict set when applying patches, rebasing or merging then you can use git rerere (reuse recorded resolution) function. This allows you to pre-define how conflicts should be resolved based on how you resolved them in the past. See http://git-scm.com/blog/2010/03/08/rerere.html for details of how this works.