TortoiseGit Manual

Merging

Where branches are used to maintain separate lines of development, at some stage you will want to merge the changes made on one branch back into the other branch, or vice versa.

It is important to understand how branching and merging works in Git before you start using it, as it can become quite complex. For hints where to find more information about Git and merging see the section called “Reading Guide”.

The next point to note is that merging always takes place within a working tree. If you want to merge changes into a branch, you have to have a working tree for that branch checked out, and invoke the merge wizard from that working tree using TortoiseGitMerge....

Figure 2.54. Merge dialog

Merge dialog


In general it is a good idea to perform a merge into an unmodified working tree. If you have made other changes in your working tree, commit those first. If the merge does not go as you expect, you may want to abort the merge using the Abort Merge command which might discard all changes (depending on the mode, in case of hard).

You can choose one commit that you want to merge from.

HEAD

Current commit checked out.

Branch

The latest commit of chosen branch.

Tag

The commit of chosen tag.

Commit

Any commit, you click ... to launch log dialog to choose commit. You also can input commit hash, or friendly commit name, such as HEAD~4.

Squash Just merge change from the other branch. Can't recorder Merge information. The new commit will not record merge branch as one parent commit. Log view will not show merge line between two branch.

No Fast Forward Generate a merge commit even if the merge resolved as a fast-forward. See https://stackoverflow.com/q/41794529/3906760 for an example of fast-forward vs. non-fast-forward merge.

No Commit Do not automatically create a commit after merge.

Messages Populate the log message with one-line descriptions from the actual commits that are being merged. Can specify the number of commits to be included in the merge message.

Conflicts

Although major merge work is done by git automatically, a conflict may happen during merge (i.e., a file is modified in both branches, the current one and the one you want to merge), please see the section called “Resolving Conflicts” on how to resolve conflicts.

Please note, that "REMOTE"/"theirs" in the conflict editor refers to the to the changes your on the branch you selected for merging and "LOCAL"/"mine" to your HEAD version in your working tree.

You can see more information at the section called “git-merge(1)”.