Posted on

This pages collects my tips and tricks for challanges with git that I often encounter. These are mainly tested on Git for Windows.

Clone repository including submodules

Normally git clone does not also clone any submodules (i.e. git repositories within the git repository) when cloning. This behaviour can be changed using the --recursive flag1.

git clone --recursive $repo

Download submodules manually

If you already have cloned the parent repository, you can still clone the submodules manually2.

git clone $repo
cd $repo
git submodule update --init --recursive

Add git username/email to a specific project

Sometimes I might need to have a seperate username or email when comitting a specific project, rather than the global username / email. This can be setup in the git settings for the project using the --local flag.

git config --local user.name "Arnav Jain"
git config --local user.email example@arnav.jain.se
comments powered by Disqus