Resolve Conflicts - grnet/e-science GitHub Wiki

Selecting upstream / head

When a conflict happens where we know our file or the upstream file is the valid one we do not need to manually resolve conflicts by editing the files. Instead we can use either of these recipes:

  • Upstream file is the 'good' one.

$ git checkout --theirs <file>

$ git add <file>

  • origin file is the 'good' one.

$ git checkout --ours <file> (or git checkout --head <file>)

$ git add <file>

###Provisions before a troublesome merge In case we are preparing to do a particularly difficult merge and want an easy revert:

  1. commit our last "known good" code

  2. give our commit hash a friendly name (tag) $ git tag -a orka-0.1.1 -m 'tag as orka-0.1.1 for kamaki 0.13.1'

  3. in case of wanting to go back to that known good commit $ git reset --hard <tagname> where <tagname> from the previous example would be orka-0.1.1

Additionally an in-progress merge or resetting a fetch can be done with git merge --abort

⚠️ **GitHub.com Fallback** ⚠️