Alex Rivera | Logout

Bash: Git submodule foreach?

Asked 2011-12-03T01:25:15.387
12

I have sup aliased to submodule foreach 'git co master; git up' (co & up are aliases for checkout & pull --rebase, respectively.).

How do add a condition so that if the submodule name is Libraries/JSONKit, it checks out the branch named experimental, instead of master?

Edit
Report

1 Answer

1

Add the following to .git/config:

[alias]
    sup = "submodule foreach 'if [ $name == \"Libraries/JSONKit\" ]; then git co experimental; else git co master; fi; git up'"
answered 2011-12-03T18:04:06.460

Your Answer