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 https://community.atlassian.com/t5/Sourcetree-questions/How-to-create-a-GIT-repository-in-existing-folder-full-of-files/qaq-p/264461    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
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,902 views 0 12
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