Using Check Out in SmartGit
The Git Checkout Command is used to switch between branches in a repository.
There are several ways to check out in SmartGit:
- Working Tree Window and Log Window: Double-click on a branch in the Branches view and confirm the Check Out dialog that appears.
- Working Tree Window: Invoke Branch | Check Out from the menu. This opens the Check Out dialog, where you can select the commit to check out. Use the Branches button to open the Select Branches dialog and select which refs should be shown in the graph. There you can also enable Include tracked remote branches.
- Log Window and Standard Window: Select the commit in the Graph View and use Check Out from the Graph context menu.
When you check out a remote branch, you can optionally create a new local branch and set up branch tracking.
When no local tracking branch exists yet, the Check Out dialog lets you select Create local branch:, enable Track remote branch, or choose Don’t create local branch (just work read-only).
If SmartGit detects a single local tracking branch for the selected remote branch, it can offer **Checkout local branch ‘
If you check out a local branch that tracks a remote branch, and if the remote branch has commits ahead of the local branch, you can either:
- Check out the local branch without merging new commits from the remote tracking branch, or
- Check out the local branch and allow SmartGit to perform a fast-forward merge to the latest commit of the remote branch.
SmartGit presents these choices as Just Checkout and Fast-Forward-Merge.
For more information on merging, see Merge.
Common Issues during Check Out
- If you have local changes in your working tree, the check out process may fail. In this case, SmartGit will offer to stash the local changes before executing the actual Check Out command, and then re-apply the changes from your stash after the command completes. For more information on stashes, see Stashes.
- If a
.gitattributesfile is present in your repository and its content differs between the checkout source commit (old commit) and the checkout target commit (new commit), SmartGit will inspect the line endings in your working tree. Changes in.gitattributesmay require line endings for certain files to be modified.
Note
In most cases, line-ending corrections won’t be necessary, and this part of the Check Out process is quick (you may not even notice it).
However, certain changes to .gitattributes can affect many (or all) files, which may cause line-ending correction to take more time.