1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
\r
3 <sect1 id="tsvn-dug-ignore">
\r
4 <title>Ignoring Files And Directories</title>
\r
6 <primary>ignore</primary>
\r
9 <primary>unversioned files/folders</primary>
\r
11 <?dbhh topicname="HIDD_IGNORE"?>
\r
12 <?dbhh topicname="HIDD_INPUTDLG"?>
\r
14 <figure id="tsvn-dug-ignoring-dia-1">
\r
15 <title>Explorer context menu for unversioned files</title>
\r
16 <graphic fileref="../images/ContextMenuFileIgnore.png"/>
\r
18 In most projects you will have files and folders that should not be subject
\r
19 to version control. These might include files created by the compiler,
\r
20 <filename>*.obj, *.lst</filename>, maybe an output folder used to store
\r
21 the executable, <filename>bin/, obj/</filename>.
\r
22 More examples include user-specific workspace settings <filename>*.suo, *.user</filename>(Visual Studio),
\r
23 backup files <filename>*.bak, Backup*/</filename>,
\r
24 Shell metadata files <filename>Thumbs.db, Desktop.ini, .DS_Store/</filename>.
\r
25 Whenever you commit changes, TortoiseGit shows your unversioned
\r
26 files, which fills up the file list in the commit dialog. Of course you
\r
27 can turn off this display, but then you might forget to add a new source
\r
31 The best way to avoid these problems is to add the derived files
\r
32 to the project's ignore list. That way they will never show up in
\r
33 the commit dialog, but genuine unversioned source files will still
\r
37 If you <action>right click</action> on one or more unversioned files,
\r
38 and select the command
\r
40 <guimenu>TortoiseGit</guimenu>
\r
41 <guimenuitem>Add to Ignore List</guimenuitem>
\r
43 from the context menu, a submenu appears allowing you to select ignore by names or by extensions.
\r
44 Ignore dialog shows that allows you to select ignore type and ignore file.
\r
45 <figure id="tsvn-dug-ignoring-dia-2">
\r
46 <title>Ignore dialog</title>
\r
47 <graphic fileref="../images/IgnoreDialog.png"/>
\r
53 <term>Ignore item(s) only in containing folder(s)</term>
\r
56 Only ignore the selected pattern(s) within that folder(s).
\r
61 <term>Ignore item(s) recursively</term>
\r
64 Ignore items with the selected pattern(s) in that folder(s) and child folder(s).
\r
73 <term>.gitignore in the repository root</term>
\r
76 Write the ignore entries in .gitignore in the repository root.
\r
77 This allows you to synchronize the ignore list with remote repository.
\r
82 <term>.gitignore in the containing directories of the items</term>
\r
85 Write the ignore entries in .gitignore in the containing directories of the items.
\r
86 This allows you to synchronize the ignore list with remote repository.
\r
91 <term>.git/info/exclude</term>
\r
94 Write the ignore entries in .git/info/exclude in repository metadata.
\r
95 This allows you to store the ignore list locally, but cannot synchronize with remote repository.
\r
102 If you want to remove one or more items from the ignore list,
\r
103 in current version of TortoiseGit, you have to manually edit the ignore list file using a text editor that can handle Unix EOL.
\r
104 That allows you to specify more general
\r
105 patterns using filename globbing, described in the section below.
\r
106 Read <xref linkend="gitignore(5)"/> for more information.
\r
107 Please be aware that each ignore pattern
\r
108 has to be placed on a separate line. Separating them by spaces does not work.
\r
112 <title>The Global Ignore List</title>
\r
114 Another way to ignore files is to add them to the
\r
115 <firstterm>global ignore list</firstterm>. The big difference here
\r
116 is that the global ignore list is a client property.
\r
117 It applies to <emphasis>all</emphasis> Git projects, but on
\r
118 the client PC only. In general it is better to use the
\r
119 <filename>svn:ignore</filename> property where possible, because it
\r
120 can be applied to specific project areas, and it works for
\r
121 everyone who checks out the project. Read
\r
122 <xref linkend="tsvn-dug-settings-main"/> for more information.
\r
128 <title>Ignoring Versioned Items</title>
\r
130 Versioned files and folders can never be ignored - that's a feature
\r
131 of Git. If you versioned a file by mistake, read
\r
132 <xref linkend="tsvn-howto-unversion"/> for instructions on how to
\r
133 <quote>unversion</quote> it.
\r
137 <sect2 id="tsvn-dug-ignore-glob">
\r
138 <title>Pattern Matching in Ignore Lists</title>
\r
140 <primary>globbing</primary>
\r
143 <primary>pattern matching</primary>
\r
146 Git's ignore patterns make use of filename globbing,
\r
147 a technique originally used in Unix to specify files using
\r
148 meta-characters as wildcards. The following characters have
\r
155 Matches any string of characters, including
\r
156 the empty string (no characters).
\r
164 Matches any single character.
\r
172 Matches any one of the characters enclosed in the
\r
173 square brackets. Within the brackets, a pair of
\r
174 characters separated by <quote>-</quote>
\r
175 matches any character lexically between the two.
\r
176 For example <literal>[AGm-p]</literal> matches
\r
177 any one of <literal>A</literal>, <literal>G</literal>,
\r
178 <literal>m</literal>, <literal>n</literal>,
\r
179 <literal>o</literal> or <literal>p</literal>.
\r
186 Pattern matching is case sensitive, which can cause problems
\r
187 on Windows. You can force case insensitivity the hard way
\r
188 by pairing characters, eg. to ignore <literal>*.tmp</literal>
\r
189 regardless of case, you could use a pattern like
\r
190 <literal>*.[Tt][Mm][Pp]</literal>.
\r
194 If you want an official definition for globbing, you can find
\r
195 it in the IEEE specifications for the shell command language
\r
196 <ulink url="http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_13">
\r
197 <citetitle>Pattern Matching Notation</citetitle>
\r
202 <title>No Paths in Global Ignore List</title>
\r
204 You should not include path information in your pattern.
\r
205 The pattern matching is intended to be used against plain
\r
206 file names and folder names.
\r
207 If you want to ignore all <literal>CVS</literal> folders,
\r
208 just add <literal>CVS</literal> to the ignore list. There is
\r
209 no need to specify <literal>CVS */CVS</literal> as you did in
\r
211 If you want to ignore all <literal>tmp</literal> folders
\r
212 when they exist within a <literal>prog</literal> folder but
\r
213 not within a <literal>doc</literal> folder you should use the
\r
214 <literal>svn:ignore</literal> property instead. There is no
\r
215 reliable way to achieve this using global ignore patterns.
\r