Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Multiple working trees?

David Bainbridge January 16, 2013

Is it possible to have two separate branches of the same repository open at the same time? I'd like to have an Xcode project open from one branch and the same Xcode project open but from another branch at the same time. So it would seem to me I would need two bookmarks specified. Both would point to the same repository but would allow me to work on two different branches of the same repository at the same time. Is this correct?

1 answer

1 accepted

0 votes
Answer accepted
KieranA
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 16, 2013

Hey dkb,

We actually do this ourselves here to save switching branches. The way to do it is checkout multiple copies of your project, but each folder in your file system having different branches checked out. So essentially the same repository checked out multiple times to different locations. You can name the bookmark whatever you want which will give it the folder name to reflect the bookmark name allowing you to tell the difference. So for SourceTree we could give it names such as SourceTree_1_4 to indicate version 1.4. In Xcode you can quickly find out what version you're on (because it will just tell you your project name) by cmd + clicking on the very top middle where the project name is, and it will tell you the location of your project.

Hope that helps

David Bainbridge January 16, 2013

Thanks. That answers my question perfectly. I wonder if there isn't a new feature lurking here. This concept could be better integrated into SourceTree. The ability for SourceTree to handle creation and switching between "independent" working trees.

KieranA
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 17, 2013

The bookmarks reflect paths. I can see where you're going for hot-swapping between branches, but usually if you're doing that you need to do an update anyway as there's typically changes in other branches. Plus, the line between updating to a branch and switching between different directories becomes very blurred and can make it more confusing for the user. SourceTree reflects what Git/Mercurial does, and if we did what you suggested then it wouldn't be reflecting that functionality. Good idea otherwise though, it's just Git/Mercurial isn't designed to do this kind of thing :)

David Blickstein September 1, 2017

Git now provides a MUCH better way to do this and I would LOVE to see SourceTree support it.

Right now, I haven't the foggiest I deal what SourceTree is going to "see" if I create a second working tree.    I'd like to think it's exactly what I'd see today if there wasn't a second working tree.   That would be safe - but it would mean that I couldn't use SourceTree in the second working tree.

https://stacktoheap.com/blog/2016/01/19/using-multiple-worktrees-with-git/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events