revision control

Submodules 🧠

Clone a repo with submodules right off the bat: git clone --recurse-submodules

If you forget and need to clone the submodules after the fact: git submodule init; git submodule update

To update the submodules: git pull --recurse-submodules

To add a submodule:

git submodule add <url>

Useful Tricks

List all files being tracked: git ls-tree -r master —name-only

View approximate size of the git repo: git count-objects -vH

Search commit messages: git log —grep ‘string’

Search the actual /diff contents/ of commits: git log -G "regex" This is a little slower than -S, which only looks for cases where a word was added or removed (so may not find what you want). How to grep Git commit diffs or contents for a certain word?