]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - bin/git-update.sh
bin/valgrind{,-ptr}.sh: Add.
[config/dotfiles.git] / bin / git-update.sh
1 #!/bin/sh
2
3 # Push current commits to all remotes and fetch from all remotes. Then display
4 # unmerged commits and changes in the repositories.
5 #
6 # If an argument is given cd to this directory before running the commands.
7 #
8 # Very useful to sync multiple remotes.
9
10
11 if [ x$1 != x ]; then
12     echo $1
13     cd "$1"
14 fi
15
16 # Get all remote changes.
17 git remote update 2>&1 | grep -v Fetching
18 # Push all local changes to remote(s).
19 for remote in `git remote`; do
20     git push $remote 2>&1 | grep -v 'Everything up-to-date'
21     git push --tags $remote 2>&1 | grep -v 'Everything up-to-date'
22 done
23 # Show unmerged changes.
24 git branch -rv --color --no-merged
25 # Show uncommitted changes.
26 if `echo "$1" | grep '\.git\$' > /dev/null`; then
27     cd ..
28 fi
29 git status | grep 'Changes to be committed:' > /dev/null \
30     && echo '-> modified (staged)'
31 git status | grep 'Changed but not updated:' > /dev/null \
32     && echo '-> modified'
33 git status | grep 'Untracked files:' > /dev/null \
34     && echo '-> modified (untracked)'
35
36 echo