Contributing patches from Mercurial to Git?

I’d like to fork a Git repository, convert it to Mercurial, and contribute my changes back to the original Git repository when I’m done. I am more concerned with a safe and stable conversion process than its convenience. I will be pulling changes from Git into Mercurial on a regular basis but rarely contributing any changes back.

I’m not comfortable using hg-git because many of the bugs reported against the project have gone unanswered for years. I suspect it’s safer to use hg convert to convert Git to Hg than using hg-git.

  • using git to clone a CodePlex project that uses SVN
  • Detach subdirectory (that was renamed!) into a new repo
  • git / github and web server deployment configuration
  • git merge & rebase: Do they only affect the currently checked out branch?
  • Getting Beyond Compare to Diff 2 Branches Simultaneously
  • Git rebase (Merge Squash) my feature branch onto another branch
  • My question is: say I’ve already converted the repository to Mercurial and made some changes, how do I contribute these changes back to the official repository? I’d like to contribute my changes back to the official Git repository without losing any history information (that is, I don’t want to fold multiple changesets into a one).

    What is the easiest and safest way to do this?

  • GIT: What is commits priority during merge?
  • Why git 0.01 doesn't have git-add?
  • Run git bash script in Windows 7/64bit
  • How can I host Git repositories and manage my content-hosting myself?
  • Git “NO-HEAD” statement
  • How to get the Git hash of the current working directory?
  • One Solution collect form web for “Contributing patches from Mercurial to Git?”

    You can try and export your Mercurial commits as patches:

    hg export --git -r 1 >patch.diff

    This .diff file should be recognized by Git and could be added to the git repo with git apply.
    (This was suggested in “Convert a Mercurial Repository to Git”, where the more up-to-date script hg-fast-export was also mentioned)

    The --git option of hg export will make sure you generate diffs in the git extended diff format. See hg help diffs for more information.

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