Resolve Merge Issues

From Koha Wiki

Jump to: navigation, search
Koha > Technical > Development > Git

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/
error: installer/data/mysql/ patch does not apply
error: patch failed:
error: 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/
CONFLICT (content): Merge conflict in installer/data/mysql/
CONFLICT (content): Merge conflict in
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/
  • 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/
    • unmerged:
  • 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, it looks like this
our $VERSION = '';
our $VERSION = '';
>>>>>>> BUG 2761 Fix max length of itemcallnumber to
  • To fix this conflict you will need to delete all but “our $VERSION = '';”
  • 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
Personal tools