Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Link an existing GIT branch on a remote repo. to an existing folder

Ok, this is a similar question to    but yet a bit different.

Here is the scenario.    A have an existing directory on my computer that has existing files in it.   This directory is not under GIT control at all now.     I want to associate this folder to an existing remote branch (B1) on an existing remote repo (RemRepo1).

I was wondering how I would do this with sourcetree.   I am suspecting that you can't use the wizard how you  create a sourcetree project and you would have to do some bash commands like first GIT init the folder to make a local repo and somehow go from there but I am not sure how - or with luck if there is a simpler way.   The directory (and the remote existing repo branch) is rather large so checking out that whole remote repo and branch in one place and pasting all the code into it might not be ideal but I am open to whatever I need to do to best accomplish this.

1 answer

0 votes
Manju Atlassian Team Jun 05, 2018

I'm afraid its not possible to achieve this without having the repository locally on disk. My recommendation is to clone the repo and checkout the branch you need. Then, move the directory to the location you need, add all the new files in Sourcetree to be tracked and you are good to commit and push. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,091 views 5 13
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you