3 # Push current commits to all remotes and fetch from all remotes. Then display
4 # unmerged commits and changes in the repositories.
6 # If --local is given as option, no fetching/pushing is performed.
8 # If an argument is given cd to this directory before running the commands.
10 # Very useful to sync multiple remotes.
12 # Copyright (C) 2011-2012 Simon Ruderich
14 # This program is free software: you can redistribute it and/or modify
15 # it under the terms of the GNU General Public License as published by
16 # the Free Software Foundation, either version 3 of the License, or
17 # (at your option) any later version.
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
29 if [ x$1 = x--local ];then
39 if [ x$LOCAL = x ]; then
40 # Get all remote changes.
41 git remote update 2>&1 | grep -v Fetching
42 # Push all local changes to remote(s).
43 for remote in `git remote`; do
44 git push $remote 2>&1 | grep -v 'Everything up-to-date'
45 git push --tags $remote 2>&1 | grep -v 'Everything up-to-date'
48 # Show unmerged changes.
49 git branch -rv --color --no-merged
50 # Show uncommitted changes.
51 if `echo "$1" | grep '\.git\$' > /dev/null`; then
54 git status | grep 'Changes to be committed:' > /dev/null \
55 && echo '-> modified (staged)'
56 git status | grep 'Changed but not updated:' > /dev/null \
58 git status | grep 'Untracked files:' > /dev/null \
59 && echo '-> modified (untracked)'