Take the 2-minute tour ×

I am using Hg for my development. Recently, I upgraded to Lion and Xcode 4.2 and I have created a Xcode project in my source tree. The Xcode by default uses Git and created .git folder in the project folder.

Being able to do versioning in Xcode is a plus but it is sort of redundant with both Git and Hg.

The problem is, should I check in the .git (folder and files) in the Xcode project folder or not? Or should I just switch off Git in Xcode and delete .git folder?


share|improve this question

3 Answers 3

The second. Versioning version data doesn't make much sense, unless you want to track the state of the entire git repository in your mercurial repository. Even worse, if you also add the .hg to the git repo, both repositories will try to track each other; once you commit to hg, git will see a difference, which you should then commit, and then hg in turn sees a new difference, and so on, indefinitely.

In other words, it doesn't make sense to put the version control directory under version control. Either roll with only git, or with only mercurial. If you really want to, you can use git to interface with mercurial repositories, and vv (AFAIK both can read each other's data structures), and you can even use them alongside each other, but that would be kind of redundant and pointless.

share|improve this answer
Understood. @tdammers, you mentioned that I can use git to interface with mercurial repositories and vice versa, because both can read each other's data, do you mean that I can use hg in Xcode? How do I make Xcode to read hg data structures? Thanks. –  Adrian Hoe Oct 25 '11 at 13:36
What I mean is that you can use git (the collection of command-line tools) to read hg repositories through git-hg. I doubt you can make it work in Xcode easily. –  tdammers Oct 25 '11 at 13:38

.git is the folder that has the git repo of XCode. If you want to keep both your Hg and git repos in sync you can use something like hg-git

share|improve this answer
@tdammers and yasouser: Thanks for your input. After reading your solutions and some research, I think I have no other choices but to have both git and hg repositories on my server. –  Adrian Hoe Oct 31 '11 at 8:18
up vote 0 down vote accepted

When having projects in both git and hg repositories, clone your projects from both repositories into different work copy folder. If you preferred, use hg-git to check out git repository using hg.

In my case, I use SourceTree, a GUI client, that supports both git and hg so I don't have to deal with the complexity of setting up hg-git.


share|improve this answer

Your Answer


