~/myproj (master)$ git remote add hg-fast-export https://github.com/frej/fast-export.git ~/myproj (master)$ git fetch hg-fast-export master ~/myproj (master)$ git read-tree --prefix=hg-fast-export/ -u remotes/hg-fast-export/master ~/myproj (master)$ git pull --squash -s subtree --no-commit hg-fast-export master ~/myproj (master)$ git pull --squash -s recursive -Xsubtree=hg-fast-export/ --no-commit hg-fast-export master ~/myproj (master)$ git diff-tree hg-fast-export master
- Add the remote that hosts the sub-package.
- Fetch the branch from the remote that you want to use in your project.
- Read the remote branch into its own folder tree in the working copy. The name of the new directory is provided by the prefix if you append a slash at the end.
- Merge updates from the sub-package into the hg-fast-export tree, squash them all into a single commit, but don't auto-commit. This gives you a chance to check the merge, before commiting. Merge prepopulates the message with a summary of the commit messages from the sub-package's remote branch.
- Explicitly specify trees to merge if Git subtree merge strategy can't determine by itself.
- Get diff between two trees.
Pushing to gh-pages for Github pages is a perfect use of subtree merge strategy - I provide an example in this SO answer.