Skip to content

Instantly share code, notes, and snippets.

@marcuswestin
Last active October 8, 2015 18:58
Show Gist options
  • Save marcuswestin/3375528 to your computer and use it in GitHub Desktop.
Save marcuswestin/3375528 to your computer and use it in GitHub Desktop.
These scripts are now maintained at https://github.com/marcuswestin/git-star
# See https://github.com/marcuswestin/git-star for new version of this script
#!/bin/bash
set -e # die on error
cd $(git rev-parse --show-toplevel)
REMOTE="origin"
BRANCH=`git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ $2 ]; then
REMOTE=$1
BRANCH=$2
elif [ $1 ]; then
BRANCH=$1
fi
echo "Pushing..."
git push $REMOTE $BRANCH
# See https://github.com/marcuswestin/git-star for new version of this script
#!/bin/bash
# Usage: gitup [[remote] branch]
# Examples:
#> gitup
#> gitup master
#> gitup origin master
#> gitup marcuswestin_remote feature_branch
set -e # die on error
cd $(git rev-parse --show-toplevel)
REMOTE="origin"
BRANCH=`git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ $2 ]; then
REMOTE=$1
BRANCH=$2
elif [ $1 ]; then
BRANCH=$1
fi
git checkout $BRANCH
echo "Update git repo `pwd` from $REMOTE/$BRANCH"
git pull $REMOTE $BRANCH
git submodule init
git submodule sync
git submodule update
# See https://github.com/marcuswestin/git-star for new version of this script
#!/bin/bash
set -e # die on error
cd $(git rev-parse --show-toplevel)
REMOTE="origin"
BRANCH=`git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ $2 ]; then
REMOTE=$1
BRANCH=$2
elif [ $1 ]; then
BRANCH=$1
fi
gitup $REMOTE $BRANCH
echo "Pushing..."
git push $REMOTE $BRANCH
@marcuswestin
Copy link
Author

Easy install:

# gitup
curl https://raw.github.com/gist/3375528/gitup.sh > /tmp/gitup.sh
chmod +x /tmp/gitup.sh
mv /tmp/gitup.sh /usr/local/bin/gitup

# gitupnpush
curl https://raw.github.com/gist/3375528/gitupnpush.sh > /tmp/gitupnpush.sh
chmod +x /tmp/gitupnpush.sh
mv /tmp/gitupn_push.sh /usr/local/bin/gitupnpush

# gitpush
curl https://raw.github.com/gist/3375528/gitpush.sh > /tmp/gitpush.sh
chmod +x /tmp/gitpush.sh
mv /tmp/gitpush.sh /usr/local/bin/gitpush

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment