<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
<sect1 id="tgit-dug-revert">
	<?dbhh topicname="HIDD_REVERT"?>
	<title>Undo Changes</title>
	<indexterm>
		<primary>revert</primary>
	</indexterm>
	<indexterm>
		<primary>undo</primary>
	</indexterm>
	<para>
		If you want to undo all changes you made in a file since
		your last commit you need to select the file,
		<action>right click</action> to pop up the context menu and then select
		the command
		<menuchoice>
			<guimenu>TortoiseGit</guimenu>
			<guimenuitem>Revert</guimenuitem>
		</menuchoice>
		A dialog will pop up showing you the files that you've changed and
		can revert. Select those you want to revert and click on
		<guibutton>OK</guibutton>.
		<figure id="tgit-dug-revert-dia-1">
			<title>Revert dialog</title>
			<graphic fileref="../images/Revert.png"/>
		</figure>
	</para>
	<para>
		If you want to undo a deletion or a rename, you need to use
		Revert on the parent folder (or commit or repository status dialog) as the deleted item does not
		exist for you to right-click on.
	</para>
	<para>
		If you want to undo the addition of an item, this appears in
		the context menu as
		<menuchoice>
			<guimenu>TortoiseGit</guimenu>
			<guimenuitem>Delete (keep local)</guimenuitem>
		</menuchoice>.
		This is really a revert as well, but the name has been changed
		to make it more obvious.
	</para>
	<para>
		The columns in this dialog can be customized in the same way as the
		columns in the <guilabel>Check for modifications</guilabel> dialog.
		Read <xref linkend="tgit-dug-wcstatus-2"/> for further details.
	</para>
	<tip>
		<title>Undoing Changes which have been committed</title>
		<para>
			<menuchoice>
				<guimenuitem>Revert</guimenuitem>
			</menuchoice>
			will only undo your local changes. It does <emphasis>not</emphasis>
			undo any changes which have already been committed. If you want to
			undo all the changes which were committed in a particular revision,
			read <xref linkend="tgit-dug-showlog"/> and <xref linkend="tgit-dug-repobrowser"/> for further information.
		</para>
	</tip>
	<tip>
		<title>Reverting a whole commit</title>
		<para>
			If you want to undo a whole commit, then you should use the log dialog and select
			<menuchoice>
				<guimenuitem>Revert change by this commit</guimenuitem>
			</menuchoice>
			on a revision/commit (cf. <xref linkend="tgit-dug-showlog"/>). Then all changes of this commit are undone and a revert commit is created which need to be committed manually (cf. <gitdoclink cmd="git-revert" section="1"/>).
			It is also possible to (hard) reset to a previous commit, then all commits after that are forgotten (cf. <xref linkend="tgit-dug-reset"/>) - this might not be recommended if the changes are already pushed (also see <ulink url="https://stackoverflow.com/q/27032850/3906760">https://stackoverflow.com/q/27032850/3906760</ulink>).
		</para>
	</tip>
	<tip>
		<title>Reverting to an old version of a file</title>
		<para>
			If you want to revert a file to an older version open the Log Dialog (cf. <xref linkend="tgit-dug-showlog"/>) on the file (or the folder if the file was deleted). Then select the specific commit you want to revert to. Now you have two options: 1) Select the specific file entry in the file list in the bottom and select <guilabel>Revert to this revision</guilabel> resp. <guilabel>Revert to parent revision</guilabel> in the context menu of the file entry. 2) Select <guilabel>Browse Repository</guilabel> (cf. <xref linkend="tgit-dug-repobrowser"/>) in the context menu of the revision. Then navigate to the file and either select <guilabel>Save revision to...</guilabel> or drag the file to the location where you want to use it.
		</para>
	</tip>
	<tip>
		<title>Revert is Slow</title>
		<para>
			When you revert changes you may find that the operation takes a lot
			longer than you expect. This is because the modified version of the
			file is sent to the recycle bin, so you can retrieve your changes
			if you reverted by mistake. However, if your recycle bin is full,
			Windows takes a long time to find a place to put the file. The
			solution is simple: either empty the recycle bin or deactivate
			the <guilabel>Use recycle bin when reverting</guilabel> box
			in TortoiseGit's settings.
		</para>
	</tip>
	<caution>
		<title>Revert != "git revert" for files</title>
		<para>
			In the TortoiseGit naming a "revert" on a file is comparable to
			<literal>git checkout HEAD -- filename</literal> (or <literal>git checkout REVISION -- filename</literal>)
			for resetting a file to it's last (or a specific) committed state. This has nothing to do with <gitdoclink cmd="git-revert" section="1"/>!
		</para>
		<para>
			<gitdoclink cmd="git-revert" section="1"/> is only referred to by <guilabel>Revert change by this commit</guilabel> in log dialog (cf. <xref linkend="tgit-dug-showlog"/>).
		</para>
	</caution>
</sect1>
