X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fgit-update.sh;h=de71bec0dc304c78b3041bd13ae85228642f05a1;hb=67988bdbeecddce25b3c64ec8f23fdc4d8d9fb66;hp=83080b965dfb42fb2a689bbc375537fb3ade1101;hpb=28f049c8e93c4a4f262bfebad4d8f61acc67b7f2;p=config%2Fdotfiles.git diff --git a/bin/git-update.sh b/bin/git-update.sh index 83080b9..de71bec 100755 --- a/bin/git-update.sh +++ b/bin/git-update.sh @@ -3,22 +3,33 @@ # 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' + git push --tags $remote 2>&1 | grep -v 'Everything up-to-date' + done +fi # Show unmerged changes. git branch -rv --color --no-merged # Show uncommitted changes.