3

If a Git repo has submodules, you have to use git clone --recursive to automatically check them out when you check out the main repo. I always forget to add the --recursive so is there a setting that makes this the default behaviour for git clone?

Jez
  • 27,951
  • 32
  • 136
  • 233
  • Possible duplicate of http://stackoverflow.com/questions/4251940/retrospectively-add-recursive-to-a-git-repo – Lemonov Nov 10 '15 at 13:05

1 Answers1

2

You can always add git alias to execute any command you need.
Add the alias with all the desired flags and you use it from now on.

git config --global alias.clonesb "clone --recursive"

from this point on yo simply need to type git clonesb and it will execute the command with the falgs

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 1
    Useless. That would mean I'd have to remember to type "clonesb" instead of "clone" when the whole point is that I generally forget to type anything other than the normal "clone". I also notice that Git ignores aliases that attempt to override normal Git commands, meaning there is no possible way to do this within Git. Bugger. – Jez Nov 10 '15 at 14:19
  • 2
    Yeah, bash shell. Not as good but at the moment the only way to do it. I'm going to ask the git development list whether `git alias` can be changed to simply allow overriding builtin Git commands. Not being able to seems like a ridiculous unnecessary limitation to me. – Jez Nov 10 '15 at 14:32