1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
\r
3 <sect1 id="tgit-dug-commit">
\r
4 <title>Committing Your Changes To The Repository</title>
\r
6 <primary>commit</primary>
\r
9 <primary>send changes</primary>
\r
12 <primary>check in</primary>
\r
14 <?dbhh topicname="HIDD_COMMITDLG"?>
\r
16 Sending the changes you made to your working tree is known as
\r
17 <firstterm>committing</firstterm> the changes. you can use
\r
19 <guimenu>TortoiseGit</guimenu>
\r
20 <guimenuitem>Check for Modifications</guimenuitem>
\r
22 first, to see which files have changed locally.
\r
24 <sect2 id="tgit-dug-commit-basics">
\r
25 <title>The Commit Dialog</title>
\r
27 If there are no conflicts,
\r
28 you are ready to commit your changes. Select any file
\r
29 and/or folders you want to commit, then
\r
31 <guimenu>TortoiseGit</guimenu>
\r
32 <guimenuitem>Commit...</guimenuitem>
\r
34 <figure id="tgit-dug-commit-dia-1">
\r
35 <title>The Commit dialog</title>
\r
36 <graphic fileref="../images/Commit.png"/>
\r
40 The commit dialog will show you every changed file,
\r
41 including added, deleted and unversioned files. If you don't
\r
42 want a changed file to be committed, just uncheck that
\r
43 file. If you want to include an unversioned file,
\r
44 just check that file to add it to the commit.
\r
47 Default commit dialog just list select paths and their child directory files.
\r
48 If you want to list all files of project, you can just click <guilabel>
\r
49 Whole Project</guilabel>
\r
52 <title>Many unversioned files in the commit dialog</title>
\r
54 If you think that the commit dialog shows you too
\r
55 many unversioned (e.g. compiler generated or editor backup)
\r
56 files, there are several ways to handle this. You can:
\r
61 add the file (or a wildcard extension)
\r
62 to the list of files to exclude on the settings page.
\r
63 This will affect every working tree you have.
\r
69 add the file to the <literal>.gitignore</literal> list
\r
72 <guimenu>TortoiseGit</guimenu>
\r
73 <guimenuitem>Add to ignore list</guimenuitem>
\r
78 Read <xref linkend="tgit-dug-ignore"/> for more information.
\r
82 <action>Double clicking</action> on any modified file in the commit
\r
83 dialog will launch the external diff tool to show your changes.
\r
84 The context menu will give you more options, as shown in the screenshot.
\r
85 You can also drag files from here into another application such as a
\r
86 text editor or an IDE.
\r
89 You can select or deselect items by clicking on the checkbox to the
\r
93 The columns displayed in the bottom pane are customizable. If you
\r
94 <action>right click</action> on any column header you will see a
\r
95 context menu allowing you to select which columns are displayed.
\r
96 You can also change column width by using the drag handle which
\r
97 appears when you move the mouse over a column boundary. These
\r
98 customizations are preserved, so you will see the same headings
\r
103 <title>Drag and Drop</title>
\r
105 You can drag files into the commit dialog from elsewhere, so
\r
106 long as the working trees are checked out from the same repository.
\r
107 For example, you may have a huge working tree with several
\r
108 explorer windows open to look at distant folders of the
\r
109 hierarchy. If you want to avoid committing from the top
\r
110 level folder (with a lengthy folder crawl to check for changes)
\r
111 you can open the commit dialog for one folder and drag in items
\r
112 from the other windows to include within the same atomic commit.
\r
115 You can drag unversioned files which reside within a working tree
\r
116 into the commit dialog, and they will be Git added automatically.
\r
122 <sect2 id="tgit-dug-commit-changelists">
\r
123 <title>Change Lists</title>
\r
125 The commit dialog supports Git's changelist feature to help
\r
126 with grouping related files together. Find out about this feature
\r
127 in <xref linkend="tgit-dug-changelists"/>.
\r
132 <sect2 id="tgit-dug-commit-ignore">
\r
133 <title>Excluding Items from the Commit List</title>
\r
135 Sometimes you have versioned files that change frequently but that you
\r
136 really don't want to commit. Sometimes this indicates a flaw in your
\r
137 build process - why are those files versioned? should you be using
\r
138 template files? But occasionally it is inevitable. A classic reason
\r
139 is that your IDE changes a timestamp in the project file every time
\r
140 you build. The project file has to be versioned as it includes all the
\r
141 build settings, but it doesn't need to be committed just because the
\r
145 To help out in awkward cases like this, we have reserved a changelist
\r
146 called <literal>ignore-on-commit</literal>. Any file added to this
\r
147 changelist will automatically be unchecked in the commit dialog.
\r
148 You can still commit changes, but you have to select it manually
\r
149 in the commit dialog.
\r
153 <sect2 id="tgit-dug-commit-restore">
\r
154 <title>Commit only parts of files</title>
\r
156 Sometimes you want to only commit parts of the changes
\r
157 you made to a file. Such a situation usually happens when
\r
158 you're working on something but then an urgent fix needs
\r
159 to be committed, and that fix happens to be in the same file
\r
163 <action>right click</action> on the file and use
\r
165 <guimenu>Context Menu</guimenu>
\r
166 <guimenuitem>Restore after commit</guimenuitem>
\r
168 This will create a copy of the file as it is. Then you
\r
169 can edit the file, e.g. in TortoiseGitMerge and undo all
\r
170 the changes you don't want to commit. After saving those
\r
171 changes you can commit the file.
\r
173 <title>Using TortoiseGitMerge</title>
\r
175 If you use TortoiseGitMerge to edit the file, you can either edit
\r
176 the changes as you're used to, or mark
\r
177 all the changes that you want to include. <action>right click</action>
\r
178 on a modified block and use
\r
180 <guimenu>Context Menu</guimenu>
\r
181 <guimenuitem>Mark this block</guimenuitem>
\r
183 to include that change.
\r
184 Finally <action>right click</action>
\r
187 <guimenu>Context Menu</guimenu>
\r
188 <guimenuitem>Use left file except marked blocks</guimenuitem>
\r
190 which will invert your changes (unmarked blocks) that you
\r
191 don't want to them to appear in current commit.
\r
196 After the commit is done, the copy of the file is restored
\r
197 automatically, and you have the file with all your modifications
\r
198 that were not committed back.
\r
201 <sect2 id="tgit-dug-commit-log">
\r
202 <title>Commit Log Messages</title>
\r
204 Be sure to enter a log message which describes the changes you are
\r
205 committing. This will help you to see what happened and when, as you
\r
206 browse through the project log messages at a later date. The message
\r
207 can be as long or as brief as you like; many projects have guidelines
\r
208 for what should be included, the language to use, and sometimes even
\r
212 You can apply simple formatting to your log messages using a convention
\r
213 similar to that used within emails.
\r
214 To apply styling to <literal>text</literal>, use
\r
215 <literal>*text*</literal> for bold,
\r
216 <literal>_text_</literal> for underlining, and
\r
217 <literal>^text^</literal> for italics.
\r
220 <figure id="tgit-dug-commit-dia-2">
\r
221 <title>The Commit Dialog Spellchecker</title>
\r
222 <graphic fileref="../images/CommitSpellcheck.png"/>
\r
224 TortoiseGit includes a spellchecker to help you get your log messages
\r
225 right. This will highlight any mis-spelled words. Use the context menu
\r
226 to access the suggested corrections. Of course, it doesn't know
\r
227 <emphasis>every</emphasis> technical term that you do, so correctly
\r
228 spelt words will sometimes show up as errors. But don't worry. You can
\r
229 just add them to your personal dictionary using the context menu.
\r
232 The log message window also includes a filename and function auto-completion
\r
233 facility. This uses regular expressions to extract class and function names
\r
234 from the (text) files you are committing, as well as the filenames themselves.
\r
235 If a word you are typing matches anything in the list (after you have typed at
\r
236 least 3 characters, or pressed <keycap>Ctrl+Space</keycap>),
\r
237 a drop-down appears allowing you to select the full name.
\r
238 The regular expressions supplied with TortoiseGit are held in the TortoiseGit
\r
239 installation <filename>bin</filename> folder. You can also define your own
\r
240 regexes and store them in <filename>%APPDATA%\TortoiseGit\autolist.txt</filename>.
\r
241 Of course your private autolist will not be overwritten when you update your
\r
242 installation of TortoiseGit. If you are unfamiliar with regular expressions,
\r
243 take a look at the introduction at
\r
244 <ulink url="https://en.wikipedia.org/wiki/Regular_expression">
\r
245 <citetitle>https://en.wikipedia.org/wiki/Regular_expression</citetitle>
\r
247 and the online documentation and tutorial at
\r
248 <ulink url="http://www.regular-expressions.info/">
\r
249 <citetitle>http://www.regular-expressions.info/</citetitle>
\r
253 Getting the regex just right can be tricky, so to help you sort out a
\r
254 suitable expression there is a test dialog which allows you to enter
\r
255 an expression and then type in filenames to test it against.
\r
256 Start it from the command prompt using the command
\r
257 <literal>TortoiseGitProc.exe /command:autotexttest</literal>.
\r
260 You can re-use previously entered log messages. Just use the command
\r
262 <guimenu>Context Menu</guimenu>
\r
263 <guimenuitem>Paste Recent messages</guimenuitem>
\r
265 to view a list of the last few
\r
266 messages you entered for this working tree. The number of stored messages
\r
267 can be customized in the TortoiseGit settings dialog.
\r
270 The log message window also includes commit message snippet facility.
\r
271 The snippets supplied with TortoiseGit are held in the TortoiseGit
\r
272 installation <filename>bin</filename> folder. You can also define your own
\r
273 snippets and store them in <filename>%APPDATA%\TortoiseGit\snippet.txt</filename>.
\r
274 # is the comment character. Use escape sequences \t \r \n \\.
\r
277 You can add your name and email address to end of log message by click
\r
278 <guibutton>Sign</guibutton>
\r
281 You can clear all stored commit messages from the <guilabel>Saved data</guilabel>
\r
282 page of TortoiseGit's settings, or you can clear individual messages from
\r
283 within the <guilabel>Recent messages</guilabel> dialog using the
\r
284 <keycap>Delete</keycap> key.
\r
287 If you want to include the checked paths in your log message, you can use
\r
290 <guimenu>Context Menu</guimenu>
\r
291 <guimenuitem>Paste filename list</guimenuitem>
\r
293 in the edit control.
\r
297 Another way to insert the paths into the log message is to simply
\r
298 drag the files from the file list onto the edit control.
\r
302 <title>Using keyboard</title>
\r
304 You can access the <guilabel>OK</guilabel> button from keyboard by pressing <keycap>Ctrl+return</keycap>.
\r
308 <title>Integration with Bug Tracking Tools</title>
\r
310 If you have activated the bug tracking system, you can set one or more
\r
311 Issues in the <guilabel>Bug-ID / Issue-Nr:</guilabel> text box. Multiple
\r
312 issues should be comma separated. Alternatively, if you are using
\r
313 regex-based bug tracking support, just add your issue references
\r
314 as part of the log message.
\r
315 Learn more in <xref linkend="tgit-dug-bugtracker"/>.
\r
320 <sect2 id="tgit-dug-commit-progress">
\r
321 <title>Commit Progress</title>
\r
323 After pressing <guibutton>OK</guibutton>, a dialog appears displaying
\r
324 the progress of the commit.
\r
325 <figure id="tgit-dug-commit-dia-3">
\r
326 <title>The Progress dialog showing a commit in progress</title>
\r
327 <graphic fileref="../images/CommitProgress.png"/>
\r
331 The progress dialog uses colour coding to highlight different
\r
338 Committing a modification.
\r
343 <term>Purple</term>
\r
346 Committing a new addition.
\r
351 <term>Dark red</term>
\r
354 Committing a deletion or a replacement.
\r
369 This is the default colour scheme, but you can customise those colours
\r
370 using the settings dialog.
\r
371 Read <xref linkend="tgit-dug-settings-colours"/> for more information.
\r