Skip to content

Instantly share code, notes, and snippets.

@unique1984
Created September 5, 2017 04:13
Show Gist options
  • Save unique1984/5653330065cbb3ab997b0febed79b0f7 to your computer and use it in GitHub Desktop.
Save unique1984/5653330065cbb3ab997b0febed79b0f7 to your computer and use it in GitHub Desktop.
Pull all Git repositories nested one directory recursively
#!/bin/bash
if [ -z $1 ]; then
find -type d -name .git -exec echo {} \; -exec git --git-dir={} --work-tree=$PWD/{}/.. fetch --all \; -exec git --git-dir={} --work-tree=$PWD/{}/.. pull origin master \;
else
find $1 -type d -name .git -exec echo {} \; -exec git --git-dir={} --work-tree=$PWD/{}/.. fetch --all \; -exec git --git-dir={} --work-tree=$PWD/{}/.. pull origin master \;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment