Skip to content

Instantly share code, notes, and snippets.

@surskitt
Created February 20, 2015 17:17
Show Gist options
  • Save surskitt/7b86292e98332b66d218 to your computer and use it in GitHub Desktop.
Save surskitt/7b86292e98332b66d218 to your computer and use it in GitHub Desktop.
gitpushall
#!/bin/bash
gitpullall() {
# Turn off noclobber in zsh, keep quiet in bash
unsetopt noclobber 2>/dev/null
for i in $(find ~/test_repos -name '.git'|xargs dirname|sort);{
cd "$i"
newfiles=$(git st|grep modified|sed 's/.*: *//')
tmpfile=$(mktemp)
echo '# Uncommented files will be added to commit' >> $tmpfile
echo >> $tmpfile
echo "$newfiles" >> $tmpfile
while grep -vE '(^#|^$)' $tmpfile > /dev/null; do
vim -u NONE $tmpfile
addedfiles=$(grep -vE '(^#|^$)' $tmpfile)
for file in "$addedfiles";{
git add "$file"
}
git commit --verbose
git push
newfiles=$(git st|grep modified|sed 's/.*: *//')
echo '# Uncommented files will be added to commit' > $tmpfile
echo >> $tmpfile
echo "$newfiles" >> $tmpfile
done
}
}
gitpullall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment