Fix spell checker issues and fail on errors on CI
[TortoiseGit.git] / doc / source / en / TortoiseGit / tgit_dug / dug_rename.xml
blobe342aaf643111d894669c83502c46fa5d0f38b8e
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
5         <para>\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
18                 </figure>\r
19         </para>\r
20         <sect2 id="tgit-dug-rename-delete">\r
21                 <title>Deleting files and folders</title>\r
22                 <indexterm>\r
23                         <primary>delete</primary>\r
24                 </indexterm>\r
25                 <indexterm>\r
26                         <primary>remove</primary>\r
27                 </indexterm>\r
28                 <para>\r
29                         Use\r
30                         <menuchoice>\r
31                                 <guimenu>TortoiseGit</guimenu>\r
32                                 <guimenuitem>Delete</guimenuitem>\r
33                         </menuchoice>\r
34                         to remove files or folders from Git.\r
35                 </para>\r
36                 <para>\r
37                         When you\r
38                         <menuchoice>\r
39                                 <guimenu>TortoiseGit</guimenu>\r
40                                 <guimenuitem>Delete</guimenuitem>\r
41                         </menuchoice>\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
44 <!--\r
45                         The file's parent folder shows a <quote>deleted</quote> icon overlay.\r
46 -->\r
47                         Up until you commit the change, you can get the file back using\r
48                         <menuchoice>\r
49                                 <guimenu>TortoiseGit</guimenu>\r
50                                 <guimenuitem>Revert</guimenuitem>\r
51                         </menuchoice>\r
52                         on the parent folder or on the or <xref linkend="tgit-dug-commit"/> or <xref linkend="tgit-dug-wcstatus"/> dialogs.\r
53                 </para>\r
54                 <para>\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
57                         <menuchoice>\r
58                                 <guimenu>Extended Context Menu</guimenu>\r
59                                 <guimenuitem>Delete (keep local)</guimenuitem>\r
60                         </menuchoice>.\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
64                 </para>\r
65 <!--\r
66                 <para>\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
72                         <menuchoice>\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
77                 </para>\r
78 -->\r
80                 <tip>\r
81                         <title>Getting a deleted file or folder back</title>\r
82                         <para>\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
85                                 <menuchoice>\r
86                                         <guimenu>TortoiseGit</guimenu>\r
87                                         <guimenuitem>Revert</guimenuitem>\r
88                                 </menuchoice>\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
94                                 <menuchoice>\r
95                                         <guimenu>Context Menu</guimenu>\r
96                                         <guimenuitem>Revert to this revision</guimenuitem>\r
97                                 </menuchoice>.\r
98                                 Refer to <xref linkend="tgit-dug-repobrowser"/> and <xref linkend="tgit-dug-showlog"/> to find out more.\r
99                         </para>\r
100                 </tip>\r
101         </sect2>\r
102         <sect2 id="tgit-dug-rename-move">\r
103                 <title>Moving files and folders</title>\r
104                 <indexterm>\r
105                         <primary>rename</primary>\r
106                 </indexterm>\r
107                 <indexterm>\r
108                         <primary>move</primary>\r
109                 </indexterm>\r
110                 <?dbhh topicname="HIDD_RENAME"?>\r
111                 <para>\r
112                         If you want to do a simple in-place rename of a file or\r
113                         folder, use\r
114                         <menuchoice>\r
115                                 <guimenu>Context Menu</guimenu>\r
116                                 <guimenuitem>Rename...</guimenuitem>\r
117                         </menuchoice>\r
118                         Enter the new name for the item and you're done.\r
119                 </para>\r
120                 <para>\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
124                         <orderedlist>\r
125                                 <listitem>\r
126                                         <para>\r
127                                                 select the files or directories you want to move\r
128                                         </para>\r
129                                 </listitem>\r
130                                 <listitem>\r
131                                         <para>\r
132                                                 <action>right-drag</action> them to the\r
133                                                 new location inside the working tree\r
134                                         </para>\r
135                                 </listitem>\r
136                                 <listitem>\r
137                                         <para>\r
138                                                 release the right mouse button\r
139                                         </para>\r
140                                 </listitem>\r
141                                 <listitem>\r
142                                         <para>\r
143                                                 in the popup menu select\r
144                                                 <menuchoice>\r
145                                                         <guimenu>Context Menu</guimenu>\r
146                                                         <guimenuitem>Git Move versioned files here</guimenuitem>\r
147                                                 </menuchoice>\r
148                                         </para>\r
149                                 </listitem>\r
150                         </orderedlist>\r
151                 </para>\r
152                 <caution>\r
153                         <title>Do Not Git Move Submodule</title>\r
154                         <para>\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
159                         </para>\r
160                 </caution>\r
161         </sect2>\r
162         <sect2 id="tgit-dug-renameincase">\r
163                 <title>Changing case in a filename</title>\r
164                 <indexterm>\r
165                         <primary>case change</primary>\r
166                 </indexterm>\r
167                 <?dbhh topicname="HIDD_RENAMEINCASE"?>\r
168                 <para>\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
174                 </para>\r
175         </sect2>\r
176         <sect2 id="tgit-dug-rename-case-conflict">\r
177                 <title>Dealing with filename case conflicts</title>\r
178                 <para>\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
185                 </para>\r
186                 <para>\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
190                 </para>\r
191                 <para>\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
196                 </para>\r
197                 <para>\r
198                         Solution\r
199                         <orderedlist>\r
200                                 <listitem>\r
201                                         <para>\r
202                                                 Delete the file in explorer.\r
203                                                 <caution>\r
204                                                         <para>\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
208                                                         </para>\r
209                                                 </caution>\r
210                                         </para>\r
211                                 </listitem>\r
212                                 <listitem>\r
213                                         <para>\r
214                                                 Open the Commit dialog.\r
215                                                 (All the checked items are of <literal>Deleted</literal> status.)\r
216                                         </para>\r
217                                 </listitem>\r
218                                 <listitem>\r
219                                         <para>\r
220                                                 Uncheck only one item you want to keep.\r
221                                         </para>\r
222                                 </listitem>\r
223                                 <listitem>\r
224                                         <para>\r
225                                                 Commit the changes.\r
226                                         </para>\r
227                                 </listitem>\r
228                                 <listitem>\r
229                                         <para>\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
231                                         </para>\r
232                                 </listitem>\r
233                         </orderedlist>\r
234                 </para>\r
235         </sect2>\r
236         <sect2 id="tgit-dug-rename-del-unversioned">\r
237                 <title>Deleting Unversioned Files</title>\r
238                 <para>\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
244                 </para>\r
245                 <para>\r
246                         TortoiseGit provides just such an option using\r
247                         <menuchoice>\r
248                                 <guimenu>Extended Context Menu</guimenu>\r
249                                 <guimenuitem>Clean up...</guimenuitem>\r
250                         </menuchoice>.\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
253                         context menu.\r
254                         This will show a dialog which lists all possible clean up options (cf. <xref linkend="tgit-dug-cleanup"/>).\r
255                 </para>\r
256         </sect2>\r
257 </sect1>\r