Created
March 2, 2019 12:54
-
-
Save sue445/28c1f0278475f8a0571f8d2e13905b52 to your computer and use it in GitHub Desktop.
git update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
if [ -n "$1" ]; then | |
master=$1 | |
else | |
master=`git remote show origin | grep 'HEAD branch:' | cut -d : -f 2 | tr -d '[[:space:]]'` | |
fi | |
current=`git branch | grep '*' | cut -f 2 -d ' '` | |
git checkout $master | |
git pull origin $master --ff-only | |
git checkout $current | |
git rebase $master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment