Skip to content

Instantly share code, notes, and snippets.

@scumdestroy
Created October 21, 2020 03:14
Show Gist options
  • Save scumdestroy/bf2db531c8e53ee886d0a7d856fcc763 to your computer and use it in GitHub Desktop.
Save scumdestroy/bf2db531c8e53ee886d0a7d856fcc763 to your computer and use it in GitHub Desktop.
update all Go repos in one command
#!/bin/sh
#save this line as "gitpullall" and you can use it in any folder to update all repos within it
alias gitpullall="find . -maxdepth 1 -type d -print -execdir git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;"
#or here ya go
#echo "alias gitpullall='find . -maxdepth 1 -type d -print -execdir git --git-dir={}/.git --work-tree=$PWD/{} pull origin master \;' >> ~/.bash_aliases"
#then make sure you run this in '~/go/src/github.com'
cd ~/go/src/github.com
find ./ -type d | cut -d '/' -f 1,2,3 | sort -u > repolist.txt
for x in $(cat repolist.txt ); do cd $x && gitpullall && cd /root/go/src/github.com ; done
rm ~/go/src/github/repolist.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment