<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
<sect1 id="tsvn-dug-merge" xmlns:xi="http://www.w3.org/2001/XInclude">
	<title>Merging</title>
	<?dbhh topicname="HIDD_MERGE"?>
	<indexterm>
		<primary>merge</primary>
	</indexterm>
	<para>
		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.
	</para>
	<para>
		It is important to understand how branching and merging works in
		Git before you start using it, as it can become quite complex.
		It is highly recommended that you read the chapter
		<xref linkend="Basic_Branching_and_Mergin"/>
		in the Git book, which gives a full description and many 
		examples of how it is used.
	</para>
	<para>
		The next point to note is that merging <emphasis>always</emphasis>
		takes place within a working copy. If you want to merge changes
		<emphasis>into</emphasis> a branch, you have to have a working copy
		for that branch checked out, and invoke the merge wizard from that
		working copy using
		<menuchoice>
			<guimenu>TortoiseGit</guimenu>
			<guimenuitem>Merge...</guimenuitem>
		</menuchoice>.
		<figure id="tsvn-dug-checkout-dia-1">
			<title>Merge dialog</title>
			<graphic fileref="../images/Merge.png"/>
		</figure>
	</para>
	<para>
		In general it is a good idea to perform a merge into an unmodified
		working copy. If you have made other changes in your WC, commit those
		first. If the merge does not go as you expect, you may want to revert
		the changes, and the <guilabel>Revert</guilabel> command will discard
		<emphasis>all</emphasis> changes including any you made before the merge.
	</para>
	<para>
		You can choose one commit that you want to merge from. 
		<xi:include href="./dug_chooseversion.xml"/> 
	</para>
	<para>
		<guilabel>Squash</guilabel> 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. 
	</para>
	<para>
		<guilabel>No Fast Forward</guilabel> Generate a merge commit even if the
		merge resolved as a fast-forward.
	</para>
	<para>
		You can see more information at <xref linkend="git-merge(1)"/>
	</para>
	<para>
		Although major merge working is done by git automatically, conflict maybe happen during merge, 
		please see <xref linked="tsvn-dug-conflicts"/> to how to resolve conflict.
	</para>
</sect1>
