I like to have my projects as self contained git repositories, with submodules for all dependencies. This way we have “one git submodule update
to rule them all”. The downside of this approach is that you need to have git mirrors for everything that doesn’t have a git repository, and the problem with 1:1 non-git mirrors is that they don’t come with a .gitignore file :).
Once you run the code, git status
starts warning you about untracked content in the submodule (For example *.pyc
files for python). We need to add a .gitignore file, but that would be untracked content too 🙂
The trick is simple, but took be time to find out: you create a branch called gitignore
in the submodule, add a .gitignore
file there, and commit. You then git commit -a
the main repo, and this would give you a clean git status
.
In order to be able to pull from origin, you can git config -e
at the submodule and add these lines:
[branch "gitignore"]
remote = origin
merge = refs/heads/master
This way you can git pull
from the submodule’s origin when it changes.