Can I use a git repo for a subfolder in a mercurial repo?

I have a mercurial repo in that includes folders like

|_ A
|_ B
|_ C

The top-level folder H contains sub-folders A, B and C.

Now, I wanted to use Heroku to test the webserver in B, and Heroku only supports git.
Since the testing is temporal, so I do not want to completely remove B from the mercurial repo. In the meanwhile, manually duplicating B for both hg and git does not seem stable.

Is there any better solution? Thanks,

  • Mercurial error: abort no username supplied
  • What's the easiest way to commit and push a single file while leaving other modifications alone?
  • Mercurial repository layout for multiple branches
  • How can I explain source control (Mercurial/Tortoise specifically) to a non-programmer?
  • TortoiseHg: Push Branch
  • (Yet another) What's the best conversion from an SVN repository to HG repository(ies)?
  • Git equivalents of most common Mercurial commands?
  • Why are Mercurial backouts in one branch affecting other branches?
  • 2 Solutions collect form web for “Can I use a git repo for a subfolder in a mercurial repo?”

    You can certainly do that – use git to version-control your web server in B. But realize that you need to separately commit changes in B for git apart from dealing with mercurial.

    I believe you can also tweak around with hg-git and make it work for you.

    Common plan can be (dirty draft)

    Using Folder B as git-subrepository in Mercurial repo at permanent basis

    In order to do it (TBT! I can miss some actions)

    • Read about subrepositories in Mercurial (and understand all pros et contas) – also this guide from aragost Trifork
    • Add hg-git extension to you local Mercurial Installation in oder to work with Git repositories from Mercurial side
    • Convert Folder B to Mecurial subrepository (read manual again)
    • Clone Mercurial’s B-repository into additional (external) Git repository
    • Replace Mercurial’s B-repository with external Git repository

    As expected result you’ll be able (I hope) to work with old tree from Mercurial and test independent Git repository in Heroku

    Git Baby is a git and github fan, let's start git clone.