<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
<sect1 id="tgit-dug-add">
	<title>Adding New Files</title>
	<indexterm>
		<primary>add</primary>
	</indexterm>
	<indexterm>
		<primary>version new files</primary>
	</indexterm>
	<?dbhh topicname="HIDD_ADD"?>
	<para>
		<figure id="tgit-dug-adding-dia-1">
			<title>Explorer context menu for unversioned files</title>
			<graphic fileref="../images/ContextMenuFileNoControl.png"/>
		</figure>
		If you created new files during
		your development process then you need to add them
		to source control too. Select the file(s) and/or NOT empty directory
		and use
		<menuchoice>
			<guimenu>TortoiseGit</guimenu>
			<guimenuitem>Add</guimenuitem>
		</menuchoice>.
	</para>
	<para>
		After you added the files to source control
		the file appears with a <literal>added</literal> icon overlay which means you
		first have to commit (and push) your working tree to make those
		files available to other developers.
		Just adding a file does <emphasis>not</emphasis> affect any remote
		repository!
	</para>
	<tip>
		<title>Many Adds</title>
		<para>
			You can also use the Add command on
			folders. In that case, the add dialog will show you all
			unversioned files inside that versioned folder.
			This helps if you have many new files and need to add
			them all at once.
		</para>
	</tip>
	<tip>
		<title>Empty directories</title>
		<para>
			Git only tracks content and, thus, cannot version (empty) directories. If you
			need a directory to be automatically created on checkout, make sure at least one
			versioned file is in it (e.g. a placeholder file such as <filename>.gitkeep</filename> or <filename>.gitignore</filename>).
		</para>
	</tip>
	<para>
		To add files from outside your working tree you can use
		the drag-and-drop handler:
		<orderedlist>
			<listitem>
				<para>
					select the files you want to add
				</para>
			</listitem>
			<listitem>
				<para>
					<action>right-drag</action> them
					to the new location inside the working tree
				</para>
			</listitem>
			<listitem>
				<para>
					release the right mouse button
				</para>
			</listitem>
			<listitem>
				<para>
					select
					<menuchoice>
						<guimenu>Context Menu</guimenu>
						<guimenuitem>Git copy and add files to this WC</guimenuitem>
					</menuchoice>.
					The files will then be copied to the working tree and
					added to version control.
				</para>
			</listitem>
		</orderedlist>
	</para>
	<para>
		You can also add files within a working tree simply by (left-)dragging and
		dropping them onto the commit dialog.
	</para>
	<para>
		If you add a file by mistake, you can undo the addition
		before you commit using
		<menuchoice>
			<guimenu>TortoiseGit</guimenu>
			<guimenuitem>Delete (keep local)...</guimenuitem>
		</menuchoice>
		or <guimenuitem>Revert</guimenuitem>.
	</para>
	<para>
		<figure id="tgit-dug-addfinish-1">
			<title>Add finished</title>
			<graphic fileref="../images/AddFinish.png"/>
		</figure>
		After adding the files, you may commit by clicking the shortcut menu button.
		Additionally, there are options to mark the newly added files as executable / symlink.
		Remember to mark executable bit for files such as Unix shell script.
		This is to facilitate sharing repository with Linux / MacOS environment.
	</para>
	<para>
		You can find more information at <gitdoclink cmd="git-add" section="1"/>
	</para>
</sect1>
