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

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

John Voigt June 4, 2018

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
Atlassian Team members are employees working across the company in a wide variety of roles.
June 5, 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
AUG Leaders

Atlassian Community Events