Resolve Merge Issues

The following tutorial will walk you through resolving merge issues in your git repository. Should you encounter errors when doing a rebase of your branch, you will need to follow these steps:

  • Fetch updates with git fetch
  • Rebase your branch with git rebase
  • If there is an error it might look something like this:
Applying BUG 2761 Fix max length of itemcallnumber to 255
error: patch failed: installer/data/mysql/kohastructure.sql:932
error: installer/data/mysql/kohastructure.sql: patch does not apply
error: patch failed: installer/data/mysql/updatedatabase.pl:2500
error: installer/data/mysql/updatedatabase.pl: patch does not apply
error: patch failed: kohaversion.pl:10
error: kohaversion.pl: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merged installer/data/mysql/kohastructure.sql
Auto-merged installer/data/mysql/updatedatabase.pl
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
Auto-merged kohaversion.pl
CONFLICT (content): Merge conflict in kohaversion.pl
Failed to merge in the changes.
Patch failed at 0001.
  • updatedabase / sysprefs / kohaversion are the main source of merge conflicts
  • The above error says that there are two files that need to be cleaned up
    • installer/data/mysql/updatedatabase.pl
    • kohaversion.pl
  • You can also find files that had merge issues by doing a git status
  • In the case above git status returns 2 files that are 'unmerged'
    • unmerged: installer/data/mysql/updatedatabase.pl
    • unmerged: kohaversion.pl
  • Open up the file in the editor of your choice and look for the lines that caused the conflict
    • It will start with «««< HEAD: and end with »»»>
    • In the case of the conflict in kohaversion.pl, it looks like this
   <<<<<<< HEAD:kohaversion.pl 
       our $VERSION = '3.01.00.045';
   =======
       our $VERSION = '3.01.00.042';
   >>>>>>> BUG 2761 Fix max length of itemcallnumber to 255:kohaversion.pl
  • To fix this conflict you will need to delete all but “our $VERSION = '3.01.00.045';”
  • Generally all you need to do is delete the ««. ====, and »» lines. In fact, the general principle for resolving merge conflicts is that you want the resulting state of the file to be what you want
  • Once the files it edited, save it and then git add it to the repository
  • Repeat those steps for all conflicts before continuing with the rebase
  • git rebase –continue
  • Sometimes after you fix the conflicts you might get an error message
Applying BUG 2761 Fix max length of itemcallnumber to 255
No changes - did you forget to use 'git add'?
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
  • This error is okay and does not list any conflicts so you can simply skip it
    • git rebase –skip
 
en/documentation/tutorials/resolvemergeissues.txt · Last modified: 2009/08/24 13:37 by nengard
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki