Last active
December 20, 2015 20:09
-
-
Save russelldavis/6188556 to your computer and use it in GitHub Desktop.
Pulls in updates from the remote tracking branch of the specified branch (defaults to current branch), rebasing them on top of the current branch and preserving merge commits.
This file contains hidden or 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/bash | |
set -e | |
orig_head=$(git rp HEAD) | |
branch=${1:-$(git rev-parse --abbrev-ref HEAD)} | |
remote=$(git config "branch.$branch.remote") | |
tracking_branch=$(git rev-parse --abbrev-ref --symbolic-full-name $branch@{u}) | |
git fetch $remote | |
git rebase --preserve-merges $tracking_branch | |
if [ "$orig_head" == $(git rp HEAD) ]; then | |
echo No update | |
else | |
echo | |
git clog $orig_head..$tracking_branch | |
echo | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment