SoruceTree renaming folders/directories

Hello

I cannot find how to rename a folder/directory using SourceTree. I only see files but no folders.

Could anybody point me in the right direction?

Kind regards,

Mauricio.

5 answers

1 accepted

Hi Mauricio,

We don't currently support renaming of folders, just files at the moment because of the way we treat the folder structure. I've filed a feature request for you on JAC, although you may want to indicate if this is for Windows or Mac. We'll likely do the same thing on both platforms. Here's the issue: https://jira.atlassian.com/browse/SRCTREE-1729

Hope that helps!

I think it's not possible at the moment (I searched for it myself in vain ...)

As git is a content tracking system, you can simply move the file within your directory tree using standard explorer actions. Doing so the hash-value (sha1) of the file keeps the same - the only thing that changes is the object tree. Git will automatically recognize the change in the directory tree, which can be commited

Hello Johannes, Kieran

Thank you for your answers. I'm running SourceTree on Windows. I'll give a try to the solution proposed by Johannes.

Kind regards,

Mauricio.

Yes, just rename the folder in Explorer then use the Add/Remove button in SourceTree, and Git will pick up that the files have been moved automatically.

Thank you Steve.

If having issues with this working via the SourceTree interface, this simple command works perfectly.

  1. click on Terminal button in tool bar
  2. terminal will automatically open to directory of proper repo
  3. type the following:  hg addremove --similarity 100
The 100 means files must be 100% the same, so if you just moved them, they will be... I you moved and renamed, you can also use a high number, say 93, and perhaps that will work for you. Either way, the command will list all of the files and their percent similarity.
I got the tip here:  http://hgtip.com/tips/advanced/2009-09-30-detecting-renames-automatically

I get

  • "hg: command not found" for hg addremove --similarity 100
  • "hg is not a git command" for git hg addremove --similarity 100

Also where in those commands do you specify the new name of the folder?

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

246 views 0 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot