How to change folder path of existing bookmark all at once?

My SourceTree is on OSX 10.8.3

I like to move existing project folders somewhere else, but there seems to be no easy way to change the folder path on existing bookmarks. The project folder under SourceTree preferences is merely for future new addition. For existing ones, I have to change it one by one.

Anyone knows how to change the folder path on existing bookmarks all at once?

2 answers

1 accepted

Hi Sean,

You'd have to modify the browser.plist file for SourceTree. I'd be very careful modifying this file though as if it's corrupt then SourceTree will have a hard time reading it. I recommend backing up this file first. It's located in /Users/<user>/Library/Application Support/SourceTree. Strangely, TextMate can't seem to read a plist file on my system, but TextWrangler managed it fine as it's just an XML file.

Step 1: Within this XML file you'll see your repository name immediately followed by the path to the repository. So, and I'm sure you guessed it, you can just do a find/replace. A caveat is that you could still wreck other repositories if your find/replace isn't specific enough. Using my repositories as example, if I suddenly decided to move everything up a level I'd do a replace on "/Users/Kieran/Documents/Development/" and change it to "/Users/Kieran/Documents/".

Step 2: Now you need to move your actual repository folders, "mv" doesn't allow wildcards in either operands so you'll need to use a loop for this, and you'll also only want to list directories. So you'd need something along the lines of:

#!/bin/bash
for folder in `find . -type d -maxdepth 1 -not -name .` ; do
	mv -v $folder &lt;wherever&gt;
done

Basically test the mv command so your folders go to the right place. Hopefully that should get the ball rolling for you.

Cheers

I need to modify that file too because I had to change the name of the underlying hard drive where everything is saved.

However on my system, that file (browser.plist) looks like it's binary, it's certainly not XML.

I tried using a PList Editor but it just told me the file was corrupted.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
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 ...

728 views 0 4
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