1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect1 SYSTEM "../../../dtd/dblite.dtd">
\r
3 <sect1 id="tgit-dug-checkout">
\r
4 <title>Checking Out A Working Tree (Switch to commit)</title>
\r
6 <primary>checkout</primary>
\r
9 <primary>Switch</primary>
\r
12 <primary>create working tree</primary>
\r
14 <?dbhh topicname="HIDD_GITSWITCH"?>
\r
16 The Switch/Checkout dialog can be used to checkout a specific version to the working tree (i.e., all files are updated to match their state of the selected version). Normally, a specific version will be represented by a (local) branch which is set as the current branch (cf. <xref linkend="tgit-dug-branchtag"/> and <xref linkend="Git User Manual_repositories-and-branches"/>).
\r
19 Select a git repository directory in windows explorer
\r
20 <action>Right click</action> to pop up the
\r
21 context menu and select the command
\r
23 <guimenu>TortoiseGit</guimenu>
\r
24 <guimenuitem>Switch/Checkout...</guimenuitem>
\r
26 which brings up the following dialog box:
\r
27 <figure id="tgit-dug-checkout-dia-1">
\r
28 <title>The Switch/Checkout dialog</title>
\r
29 <graphic fileref="../images/SwitchCheckOut.png"/>
\r
31 If you enter a branch name at <guilabel>Create New Branch</guilabel>, a new branch will be created. Also, the new branch will be set as the current branch (HEAD).
\r
34 You can click on the <guibutton>...</guibutton> to browse the references/branches/log to choose a branch to checkout.
\r
37 Check <guilabel>Overwrite working tree changes (force)</guilabel> will overwrite uncommitted changes in the working tree with the selected version.
\r
40 When you selected a remote branch, you can check <guilabel>Track</guilabel> in order to track the remote branch.
\r
41 When you open the <link linkend="tgit-dug-push">push</link>, <link linkend="tgit-dug-pull">pull</link> or <link linkend="tgit-dug-sync">sync</link> dialog, the remote branch will be pre-selected automatically.
\r
44 <sect2 id="tgit-dug-checkout-depth">
\r
45 <title>Checkout Depth</title>
\r
47 You can choose the <firstterm>depth</firstterm> you want to checkout,
\r
48 which allows you to specify the depth of recursion into child folders.
\r
49 If you want just a few sections of a large tree, You can checkout
\r
50 the top level folder only, then update selected folders recursively.
\r
53 <term>Fully recursive</term>
\r
56 Checkout the entire tree, including all child folders
\r
62 <term>Immediate children, including folders</term>
\r
65 Checkout the specified directory, including all files
\r
66 and child folders, but do not populate the child folders.
\r
71 <term>Only file children</term>
\r
74 Checkout the specified directory, including all files
\r
75 but do not checkout any child folders.
\r
80 <term>Only this item</term>
\r
83 Checkout the directory only. Do not populate it with
\r
84 files or child folders.
\r
89 <term>Working tree</term>
\r
92 Retain the depth specified in the working tree. This
\r
93 option is not used in the checkout dialog, but it is
\r
94 the default in all other dialogs which have a depth
\r
102 If you check out a sparse working tree (i.e., by choosing something other
\r
103 than <literal>fully recursive</literal> for the checkout depth), you can
\r
104 fetch additional sub-folders by using the repository browser
\r
105 (<xref linkend="tgit-dug-repobrowser" />) or the check for modifications dialog
\r
106 (<xref linkend="tgit-dug-wcstatus-2" />).
\r
109 In the repository browser,
\r
110 <action>Right click</action> on the checked out folder, then use
\r
112 <guimenu>TortoiseGit</guimenu>
\r
113 <guimenuitem>Repo-Browser</guimenuitem>
\r
115 to bring up the repository browser. Find the sub-folder you would like
\r
116 to add to your working tree, then use
\r
118 <guimenu>Context menu</guimenu>
\r
119 <guimenuitem>Update item to revision...</guimenuitem>
\r
121 That menu will only be visible if the selected item does not exist yet
\r
122 in your working tree, but the parent item does exist.
\r
125 In the check for modifications dialog, first click on the button
\r
126 <guibutton>Check repository</guibutton>. The dialog will show all
\r
127 the files and folders which are in the repository but which you
\r
128 have not checked out as <literal>remotely added</literal>.
\r
129 <action>Right click</action> on the folder(s) you would like to add
\r
130 to your working tree, then use
\r
132 <guimenu>Context menu</guimenu>
\r
133 <guimenuitem>Update</guimenuitem>
\r
137 This feature is very useful when you only want to checkout parts of a
\r
138 large tree, but you want the convenience of updating a single working
\r
139 copy. Suppose you have a large tree which has sub-folders
\r
140 <literal>Project01</literal> to <literal>Project99</literal>,
\r
141 and you only want to checkout
\r
142 <literal>Project03</literal>,
\r
143 <literal>Project25</literal> and
\r
144 <literal>Project76/SubProj</literal>.
\r
150 Checkout the parent folder with depth
\r
151 <quote>Only this item</quote>
\r
152 You now have an empty top level folder.
\r
157 Select the new folder and use
\r
159 <guimenu>TortoiseGit</guimenu>
\r
160 <guimenuitem>Repo browser</guimenuitem>
\r
162 to display the repository content.
\r
167 Right click on <literal>Project03</literal> and
\r
169 <guimenu>Context menu</guimenu>
\r
170 <guimenuitem>Update item to revision...</guimenuitem>
\r
172 Keep the default settings and click on
\r
173 <guibutton>OK</guibutton>. You now have
\r
174 that folder fully populated.
\r
177 Repeat the same process for <literal>Project25</literal>.
\r
182 Navigate to <literal>Project76/SubProj</literal> and
\r
183 do the same. This time note that the <literal>Project76</literal>
\r
184 folder has no content except for <literal>SubProj</literal>,
\r
185 which itself is fully populated. Git has created the
\r
186 intermediate folders for you without populating them.
\r
191 <title>Working tree depth cannot be reduced</title>
\r
193 Once you have checked out a working tree to a particular
\r
194 depth you can increase that depth later to get more content.
\r
195 However you cannot reduce the depth again to remove content.
\r
196 That feature may be added in a later version of Git.
\r
200 <title>Using an older server</title>
\r
202 Pre-1.5 servers do not understand the working tree depth
\r
203 request, so they cannot always deal with requests efficiently.
\r
204 The command will still work, but an older server may send all
\r
205 the data, leaving the client to filter out what is not required,
\r
206 which may mean a lot of network traffic. If possible you should
\r
207 upgrade your server to 1.5.
\r
214 If the project contains references to external projects which you do
\r
215 <emphasis>not</emphasis> want checked out at the same time, use the
\r
216 <guilabel>Omit externals</guilabel> checkbox.
\r
221 If you checkout/switch to a <guilabel>Tag</guilabel> or <guilabel>Commit</guilabel>,
\r
222 you should create a new branch. Otherwise you will
\r
223 work at "no branch" (detached HEAD state; i.e., there is no current branch, cf. <xref linkend="git-checkout(1)__detached_head"/>).
\r
224 This can be easily fixed by creating a branch at this version and switching to it.
\r
229 <title>Exporting</title>
\r
231 Sometimes you may want to create a local copy without any of those
\r
232 <filename>.git</filename> directories, e.g. to create a zipped
\r
233 tarball of your source.
\r
234 Read <xref linkend="tgit-dug-export"/> to find out how to do that.
\r