checkout to different folder

Sid Price January 5, 2016

I am a relative newcomer to Git and SourceTree but finding it extremely useful and powerful. My experience to date is with a centralized VCS and so I am hoping if I describe what I need to do someone can guide me as to how to achieve the same with SourceTree.

What I am used to doing, when trying to figure out where in a long list of changes a side effect bug may have been introduced, is to check out previous releases of the project to a temporary folder and use my file-compare tools to examine changes made. This does not seem like an approach that I can follow with SourceTree unless I am missing how to check out a previous commit to a temporary folder.

So, how does one do something similar with SourceTree?

Thanks for your patience with a newbie,

Sid

4 answers

1 vote
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 6, 2016

You can also do a diff of two commits directly within SourceTree by control-clicking or command-clicking (depending on OS) on two commits.  The bottom part of the SourceTree window will then show you which files were added, deleted, or modified (on the left) and allow you to select an individual modified file to see the specific differences (on the right)

1 vote
Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 5, 2016

Since git 2.5.0 there is also the command

git worktree

which allows to manage multiple working trees attached to the same repository.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 6, 2016

That's very cool. I don't think SourceTree supports it at all yet - however, it is now distributing git 2.6 as the embedded version, so it should be usable from the command line as described above.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 6, 2016

Here is a feature request for support for worktree: https://jira.atlassian.com/browse/SRCTREE-3204

MarqueIV January 11, 2018

Correct me if I'm wrong, but isn't it Git 2.15, not Git 2.5?  I don't even think there's a 2.2 release let alone 2.5 (at least not on Mac or Windows.)

0 votes
Johannes Kilian
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 5, 2016

Just as a hint: Git offers a special command to localize the commit where a certain feature/bug was introduced - there should be no need to have multiple clones for this task:

git bisect
0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 5, 2016

The only way I've been able to do this is to have two separate clones of the repository, and checkout different branches to each.

You can save a little disk space if your second repository is a clone of the first (local) repository, instead of cloning the remote a second time.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events