TortoiseGit Manual

Checking Out A Working Tree (Switch to commit)

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. the section called “Branching/Tagging” and user-manual man-page).

Select a git repository directory in windows explorer Right click to pop up the context menu and select the command TortoiseGitSwitch/Checkout..., which brings up the following dialog box:

Figure 2.8. The Switch/Checkout dialog

The Switch/Checkout dialog


If you enter a branch name at Create New Branch, a new branch will be created. Also, the new branch will be set as the current branch (HEAD).

You can click on the ... to browse the references/branches/log to choose a branch to checkout.

Check Overwrite working tree changes (force) will overwrite uncommitted changes in the working tree with the selected version.

When you selected a remote branch, you can check Track in order to track the remote branch. When you open the push, pull or sync dialog, the remote branch will be pre-selected automatically.

You can find more information at git-checkout(1) man-page

Important

If you checkout/switch to a Tag or Commit, you should create a new branch. Otherwise you will work at "no branch" (detached HEAD state; i.e., there is no current branch, cf. git-checkout(1) man-page). This can be easily fixed by creating a branch at this version and switching to it.

Exporting

Sometimes you may want to create a local copy without any of those .git directories, e.g. to create a zipped tarball of your source. Read the section called “Exporting a Git Working Tree” to find out how to do that.