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.

  • Getting all branches with JGit
  • git push via cron
  • How to Enable Directory Indexing on GitHub Pages
  • Git is doing very slow commits on a Samba share. What can I do to speed it up?
  • Excluding files from git-diff
  • Can't get specific file version from git repository using Python
  • 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?

  • Is there a way to configure the output of git commit?
  • How does Github for Mac synchronize?
  • Only push certain files once
  • Is there a NERDTree or other project plugin for vim that integrates with git to show the status of files?
  • Switching the entire project into a previous commit
  • Escape comment character (#) in git commit message
  • 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.