Is it possible to have 2 local folders, each containing a different branch of the same repository?

http://i.imgur.com/bn8xuw2.png

I have 2 branches of a project (A & B). I want to show the client 2 directions we could take the project in. I seem to only be able to switch the 1 project folder between the branches.

What I need is the ability to have a 2nd, completely different folder contain branch B.

1 folder for branch A - 1 folder for branch B.

That way I can show 1 thing on branch A then show the equivalent thing on branch B and have them side by side. With the current 1 folder - either A-mode or B-mode - I can't achieve this.

I don't want to switch branches within the existing folder. I want to keep branch A in the A folder then check out branch B into the B folder.

Is this possible?

1 answer

1 accepted

Hi Maurice,

Sure, we do this all the time. For SourceTree I run two branches, one for the default branch (most recent changes) and one for specific versions such as 1.5.8.

All you have to do is checkout your repository twice (or copy one folder). So in my file system I have two folders in the same directory, one called "SourceTree" and the other "SourceTreeDefault" each of which has SourceTree checked out into them. This way, I can run two instances of the same application at the same time if I want to. In each folder I have a different branch checked out. Remember that checking out a branch has nothing really to do with the remote, it's to do with your local working copy and what you've chosen to checkout.

Remember that anything which is committed and pushed in one of the repo's will be pullable in the other anyway, so they can stay in sync.

If I were you, I'd just checkout your remote to another folder in the same parent directory as your existing repository (with a different repo/folder name), then just run both projects by whatever means you're displaying them. If it's a web server you can specify a port to run them on, and if it's an application then two instances would run anyway.

Hope that helps.

Thanks Keiran

If I were you, I'd just checkout your remote to another folder in the same parent directory as your existing repository (with a different repo/folder name)

I eventually realized I could do this. I was hoping there was a way to just duplicate the existing working copy folder without needing to download the files from the remote origin again.

http://i.imgur.com/cV9aBOj.png

Does this look like what you've described or is there some other way that doesn't involving having to download everything all over again?

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

649 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you