How can I change the path of a project in SourceTree?

Maria Campbell June 30, 2015

I want to change the path of a project in SourceTree. All files in my user directory are accidentally in this project, and I just want to focus on a few files. How can I do that? I don't want to toss it in the trash, because then I will be tossing all my folders there! Thanks!

5 answers

10 votes
Balázs Szakmáry
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.
July 2, 2015

I still only halfway understand what might have happened, I think you did a git init on your user folder.

Assuming this, you should see a hidden folder called ".git" under your user folder and this is what you have to do:

  1. create a new folder where you actually want your repo to be.
  2. move the .git folder into this new folder.
  3. if there are any files in your user folder which actually should be part of your new repo, copy or move them into the new folder, next to (not into) the .git folder
  4. Go back to SourceTree, create a new bookmark to point to the new folder and open it. (If you have a bookmark pointing to the old place, delete that.)
rodolink April 14, 2018

this helped me, thanks

0 votes
Tim Crall
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.
July 1, 2015

Mac or PC?

0 votes
Maria Campbell July 1, 2015

It's Git, and yes, it's a repository. I accidentally made the path my user path (which means everything under the sun is in that repository. I just want to be able to connect it to a folder in a local development install like I had for my others. I'm still fairly new to SourceTree, so I accidentally created the new repository in bookmarks without dragging the folder in question into the bookmarks area. That resulted in the creation of a repository with a path to my user directory. I want to undo that and connect to the right area. Does that make sense? Thanks, by the way, for reaching out!

0 votes
Balázs Szakmáry
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.
July 1, 2015

Are we talking about Git or Mercurial? What do you mean by "project"? Is it a repository?

0 votes
Maria Campbell July 1, 2015

I created a project, and now I have a ton of files that are untracked in it. I only wanted a couple of files in there, but because I created the wrong path, I ended up with all these files. I haven't done anything in the project. I just want to get rid of this path and just add the couple of files I want. However, since there are so many untracked files in there, it's difficult to do anything because now SourceTree is very slow. Hope this explanation helps clarify the issue. Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events