During merge (or rebase) operations conflicts can occur. Although Git is very good at solving most issues by itself there are cases when you have to take action. An example situation is when the same line in the same file was edited in both branches - then you need to tell Git how to solve this issue.
Tower will inform you if you currently have a conflict that needs your attention: the conflicted branch is marked with a yellow warning sign icon in the Sidebar. More importantly, when you're viewing your HEAD branch in the Browse area, a yellow colored area just above the file list tells you that "x conflicts need to be solved.".
NOTE:Conflicts during rebase operations will temporarily create a "(no branch) HEAD" item in the Sidebar.
To continue working you must solve the conflicts in all concerned files.
Expand the conflicts information area by clicking "Show Details".
Select a file from the list and inspect it in the details area below. The "mine/theirs" view mode is best suited to see how the versions from the merged branches differ. Perform the following actions for each file listed in the table:
A) In very simple cases you might be able to directly decide that one of the versions (mine or theirs) is correct. You can tell Tower by right-clicking the file and choosing "Resolve <file name> Using Mine" or "Resolve <file name> Using Theirs".
On merge conflicts:
- selecting "Mine" will solve the conflict using the version of your HEAD (the branch you're merging into) while "Theirs" will solve the conflict using the version your are merging into your HEAD.
On rebase conflicts:
-selecting "Mine" will solve the conflict using the version you rebase on top of your current HEAD while "Theirs" will solve the conflict using the version you rebase onto your HEAD.
Continue with the next file or step 3.
B) In most cases, however, you'll want to solve the conflict in a merge tool.
Click the "Merge Tool" button to open the file in an external merge tool.
NOTE:You can configure which merge tool to use in Tower's preferences dialog. Be sure that the tool you're using is capable of dealing with merges. Not every diff tool supports merging!
After having decided how to solve the conflict save your solution in the merge tool and close it.
Back in Tower, you must mark the file as "solved". You can do that by right-clicking it in the list and choosing "Mark <file name> as Resolved".
After having solved all conflicts you must commit your resolution. Do so by clicking the "Commit" button - in the appearing commit sheet, a suitable merge commit message is already prefilled for you.
IMPORTANT:When rebasing, multiple merge conflicts can occur in sequence. You have to solve each conflict in turn and complete each one with the "Continue" button.
NOTE:You can always abort the merge (or rebase) by clicking the "Abort Merge" ("Abort Rebase") button in the conflict information bar. This resets your HEAD branch to the state it was before the merge began.