How to change an Hg repositoty to Git in SourceTree?

I'm very new to SourceTree and Git/Hg, and I'm stuck at the very beggining of everything.

I wanted to track the versions of a website under construction.

So I added the folder containing codes to SourceTree Bookmarks.

Although I wanted to use Git, I accidentally chose Mercurial instead.

After that, I tried to change it to Git, but I couldn't; I deleted the bookmark and repeated the addition and this time it was automatically set to Hg.

Is it difficult to set it back to Git? If it's doable even for a beginner, could somebody tell me how?

3 answers

1 accepted

You'll want to re-remove the repository from sourcetree. Navigate to the location in Explorer/Finder, and delete the .hg folder (may be hidden). Now you should be able to add the project to sourcetree with the option of which type of repository to use.

Keep in mind that you should not delete this directory on anything but a new repository because you will lose your entire history and all previous versions.

Thanks a lot! It worked well. Now I've got an idea of what .hg and .git files are.

Once you've actually done some commits, those directories hold not only the config for your repository, but also the contents of all the previous commits as well, so think twice about deleting the directory for an existing project.

Cheers! This is very helpul.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

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

561 views 1 2
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