Skip to content

Instantly share code, notes, and snippets.

@kemayo
Last active November 26, 2015 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kemayo/33d47bf4b260fa114f58 to your computer and use it in GitHub Desktop.
Save kemayo/33d47bf4b260fa114f58 to your computer and use it in GitHub Desktop.
A git utility for my own use, here so I don't forget about it
#!/bin/bash
for D in *; do
if [ -d "${D}/.git" ]; then
echo "${D}:" "${1:-pull}" "${@:2}"
git -C "${D}" "${1:-pull}" "${@:2}"
fi
done
@kemayo
Copy link
Author

kemayo commented Nov 26, 2015

Stick it somewhere on your $PATH.

> git foreach

...will git pull in all subdirectories of the current path which are a git repo.

> git foreach push --tags

...would git push --tags in all those repos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment