How to manage a project on GitHub that has an external GIT dependency not stored on GitHub

advertisements

I'm working on a project that I'd like to store on GitHub.

This project uses mupdf, which is hosted on it's own git server, e.g. git://git.ghostscript.com/mupdf.git

I want to be able to get the latest changes from mupdf, but also keep changes that I make to mupdf, while keeping my whole project on GitHub.

My first thought was to add mupdf as a submodule and then push my project to GitHub-- but what happens to changes I make to mupdf (e.g. inside the submodle)? Where do I store those? My understanding was that if I make a change inside the submodule, the commit there will only be stored locally. I read this page http://git-scm.com/book/en/Git-Tools-Submodules , but was left unsure whether this will work.

What's the best way to set up my repo, such that:

1) My entire project is on GitHub 2) I can get new changes from mupdf into my project 3) I can preserve my changes to mupdf and merge them with new changes


You can push your submodule's repo to github as well. If you would like that to be the default where the repo resides, make the adjustment in the .gitmodules file in the root of your working folder. Then issue

git submodule init

to propagate the new url to the .git/config in the submodule.