Skip to content

Instantly share code, notes, and snippets.

@peasead
Last active August 13, 2020 02:04
Show Gist options
  • Save peasead/a005a254d7ee0b8042d705ea53ab0c67 to your computer and use it in GitHub Desktop.
Save peasead/a005a254d7ee0b8042d705ea53ab0c67 to your computer and use it in GitHub Desktop.
Recursively update all git repositories
#!/bin/bash
# Run from the parent directory with all of your git folders below
# find . searches the current directory
# -type d to find directories, not files
# -depth 1 for a maximum depth of one sub-directory
# -exec {} \; runs a custom command for every find
# git --git-dir={}/.git --work-tree=$PWD/{} pull git pulls the individual directories
find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment