1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
\r
3 <sect1 id="tgit-dug-rename">
\r
4 <title>Deleting, Moving and Renaming</title>
\r
6 Unlike CVS, Git allows renaming and moving of files and
\r
7 folders. So there are menu entries for delete and rename
\r
8 in the TortoiseGit submenu. However, unlike SVN Git does not track filenames.
\r
9 Git only tracks the content of files. So there is in general no need to use the
\r
10 Git rename or remove functionality or even to "repair renames" as in SVN. Renames
\r
11 and copies are automatically detected when showing the log.
\r
12 However, using the Git delete and move functionality the files are automatically
\r
13 removed from the Git index (i.e., not shown as missing, but deleted)
\r
14 and in case of move/rename also re-added with the new names (i.e., the new names don't show up as unversioned).
\r
15 <figure id="tgit-dug-renaming-dia-1">
\r
16 <title>Explorer context menu for versioned files</title>
\r
17 <graphic fileref="../images/ContextMenuFileControl.png"/>
\r
20 <sect2 id="tgit-dug-rename-delete">
\r
21 <title>Deleting files and folders</title>
\r
23 <primary>delete</primary>
\r
26 <primary>remove</primary>
\r
31 <guimenu>TortoiseGit</guimenu>
\r
32 <guimenuitem>Delete</guimenuitem>
\r
34 to remove files or folders from Git.
\r
39 <guimenu>TortoiseGit</guimenu>
\r
40 <guimenuitem>Delete</guimenuitem>
\r
42 a file, it is removed from your working tree immediately as well
\r
43 as being marked for deletion in the repository on next commit.
\r
45 The file's parent folder shows a <quote>deleted</quote> icon overlay.
\r
47 Up until you commit the change, you can get the file back using
\r
49 <guimenu>TortoiseGit</guimenu>
\r
50 <guimenuitem>Revert</guimenuitem>
\r
52 on the parent folder or on the or <xref linkend="tgit-dug-commit"/> or <xref linkend="tgit-dug-wcstatus"/> dialogs.
\r
55 If you want to delete an item from the repository, but keep it
\r
56 locally as an unversioned file/folder, use
\r
58 <guimenu>Extended Context Menu</guimenu>
\r
59 <guimenuitem>Delete (keep local)</guimenuitem>
\r
61 You might have to hold the <keycap>Shift</keycap> key while right clicking on
\r
62 the item in the explorer list pane (right pane) in order to see this
\r
63 in the extended context menu.
\r
67 If a <emphasis>file</emphasis> is deleted via the explorer
\r
68 instead of using the TortoiseGit context menu, the commit
\r
69 dialog shows those files and lets you remove them from
\r
70 version control too before the commit.
\r
71 If you need to delete a version-controlled file, always use
\r
73 <guimenu>TortoiseGit</guimenu>
\r
74 <guimenuitem>Delete</guimenuitem>
\r
75 </menuchoice> so that Git doesn't have to guess what
\r
76 you really want to do.
\r
81 <title>Getting a deleted file or folder back</title>
\r
83 If you have deleted a file or a folder and already committed
\r
84 that delete operation to the repository, then a normal
\r
86 <guimenu>TortoiseGit</guimenu>
\r
87 <guimenuitem>Revert</guimenuitem>
\r
89 can't bring it back anymore. But the file or folder is not
\r
90 lost at all. If you know the revision the file or folder got
\r
91 deleted (if you don't, use the log dialog to find out) open
\r
92 the repository browser and switch to that revision. Then select
\r
93 the file or folder you deleted, right-click and select
\r
95 <guimenu>Context Menu</guimenu>
\r
96 <guimenuitem>Revert to this revision</guimenuitem>
\r
98 Refer to <xref linkend="tgit-dug-repobrowser"/> and <xref linkend="tgit-dug-showlog"/> to find out more.
\r
102 <sect2 id="tgit-dug-rename-move">
\r
103 <title>Moving files and folders</title>
\r
105 <primary>rename</primary>
\r
108 <primary>move</primary>
\r
110 <?dbhh topicname="HIDD_RENAME"?>
\r
112 If you want to do a simple in-place rename of a file or
\r
115 <guimenu>Context Menu</guimenu>
\r
116 <guimenuitem>Rename...</guimenuitem>
\r
118 Enter the new name for the item and you're done.
\r
121 If you want to move files around inside your working tree,
\r
122 perhaps to a different sub-folder, you can
\r
123 use the right-mouse drag-and-drop handler:
\r
127 select the files or directories you want to move
\r
132 <action>right-drag</action> them to the
\r
133 new location inside the working tree
\r
138 release the right mouse button
\r
143 in the popup menu select
\r
145 <guimenu>Context Menu</guimenu>
\r
146 <guimenuitem>Git Move versioned files here</guimenuitem>
\r
153 <title>Do Not Git Move Submodule</title>
\r
155 You should <emphasis>not</emphasis> use the TortoiseGit
\r
156 <guilabel>Move</guilabel> or <guilabel>Rename</guilabel>
\r
157 commands on a folder which has been created using
\r
158 <literal>git submodule</literal>.
\r
162 <sect2 id="tgit-dug-renameincase">
\r
163 <title>Changing case in a filename</title>
\r
165 <primary>case change</primary>
\r
167 <?dbhh topicname="HIDD_RENAMEINCASE"?>
\r
169 Making case-only changes to a filename needs special attention,
\r
170 because Windows does not honor the filename casing by default.
\r
171 Therefore just renaming a file using the rename command of the Explorer is likely not to work.
\r
172 It is important to rename it using Git in order to update the index to make it use the new filename.
\r
173 Use the <guimenuitem>Rename...</guimenuitem> command in the TortoiseGit submenu.
\r
176 <sect2 id="tgit-dug-rename-case-conflict">
\r
177 <title>Dealing with filename case conflicts</title>
\r
179 If the repository already contains two files with the same name
\r
180 but differing only in case (e.g. <filename>TEST.TXT</filename>
\r
181 and <filename>test.txt</filename>), you
\r
182 will not be able to commit, and only one of them can be checkout
\r
183 on a Windows client. Whilst Git (in general) supports case-sensitive
\r
184 filenames, Windows does not.
\r
187 This sometimes happens
\r
188 when files are committed from a system with a case-sensitive
\r
189 file system, like Linux, or when the setting <literal>core.ignorecase</literal> is set to false (cf. <xref linkend="git-config(1)"/>).
\r
192 In that case, you have to decide which one of them you want to
\r
193 keep and delete the other(s) from the repository (or rename the other(s)).
\r
194 Easiest way is to do that on a case-sensitive file system, followed by committing and pushing the changes.
\r
195 Doing it on Windows requires several steps (and two commits):
\r
202 Delete the file in explorer.
\r
205 Do NOT use the <guimenuitem>Delete</guimenuitem>
\r
206 or the <guimenuitem>Delete (keep local)</guimenuitem> command
\r
207 in the TortoiseGit submenu!
\r
214 Open the Commit dialog.
\r
215 (All the checked items are of <literal>Deleted</literal> status.)
\r
220 Uncheck only one item you want to keep.
\r
225 Commit the changes.
\r
230 Revert deletion of the wanted file in order to get it back. If you want to keep both or more files which had the "same" name, but with a different new name, do this for all files in question and rename them before proceeding with the next file.
\r
236 <sect2 id="tgit-dug-rename-del-unversioned">
\r
237 <title>Deleting Unversioned Files</title>
\r
239 Usually you set your ignore list such that all generated files are ignored
\r
240 in Git. But what if you want to clear all those ignored items to produce
\r
241 a clean build? Usually you would set that in your makefile, but if you are
\r
242 debugging the makefile, or changing the build system it is useful to have a way
\r
243 of clearing the decks.
\r
246 TortoiseGit provides just such an option using
\r
248 <guimenu>Extended Context Menu</guimenu>
\r
249 <guimenuitem>Clean up...</guimenuitem>
\r
251 You may have to hold the <keycap>Shift</keycap> while right clicking on a folder
\r
252 in the explorer list pane (right pane) in order to see this in the
\r
254 This will show a dialog which lists all possible clean up options (cf. <xref linkend="tgit-dug-cleanup"/>).
\r