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

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

This widget could not be displayed.

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.)

this helped me, thanks

This widget could not be displayed.

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!

This widget could not be displayed.

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

This widget could not be displayed.

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!

This widget could not be displayed.

Mac or PC?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

879 views 2 3
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