From 687223b44895de723bb403d66dfca87b2f778f5c Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 30 Nov 2010 10:09:48 +0100 Subject: [PATCH] bin/git-update.sh: Add --local option. --- bin/git-update.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/git-update.sh b/bin/git-update.sh index 83080b9..3fea2d6 100755 --- a/bin/git-update.sh +++ b/bin/git-update.sh @@ -3,22 +3,32 @@ # Push current commits to all remotes and fetch from all remotes. Then display # unmerged commits and changes in the repositories. # +# If --local is given as option, no fetching/pushing is performed. +# # If an argument is given cd to this directory before running the commands. # # Very useful to sync multiple remotes. +LOCAL= +if [ x$1 = x--local ];then + LOCAL=1 + shift +fi + if [ x$1 != x ]; then echo $1 cd "$1" fi -# Get all remote changes. -git remote update 2>&1 | grep -v Fetching -# Push all local changes to remote(s). -for remote in `git remote`; do - git push $remote 2>&1 | grep -v 'Everything up-to-date' -done +if [ x$LOCAL = x ]; then + # Get all remote changes. + git remote update 2>&1 | grep -v Fetching + # Push all local changes to remote(s). + for remote in `git remote`; do + git push $remote 2>&1 | grep -v 'Everything up-to-date' + done +fi # Show unmerged changes. git branch -rv --color --no-merged # Show uncommitted changes. -- 2.45.2