I've different repository and want to keep all of them up to date. A solution can be cd folder; git pull origin master
for all repositories. What I'm looking for is a way to do the same but without cd
each times.
Yes, you can have Git change into a directory automatically when it runs by passing the -C
option, like so: git -C DIR pull
.
Note that the -C
option is a general Git option and not one to git pull
, so it must be placed before pull
and not after.
If you have a set of directories under the current directory, you can script this like so:
$ find . -mindepth 1 -maxdepth 1 -type d | xargs -I{} git -C {} pull