scatterd-dotfiles/bin/git-up
Geoff Harcourt 2e3d643c54 Fetch origin and rebase against origin with git-up
In f252ba4 we lost some of the functionality of `git-up`. This change
brings back rebasing against the origin's reference and not the local
reference of the main branch. We also explicitly fetch from `origin` now
to be sure we're current before rebasing.

Close #671
2020-06-18 13:53:53 -04:00

16 lines
434 B
Bash
Executable file

#!/bin/sh
set -e
git fetch origin
if git symbolic-ref --short refs/remotes/origin/HEAD >/dev/null; then
git fetch origin
git rebase "$(git symbolic-ref --short refs/remotes/origin/HEAD)" "$@"
else
echo "You don't have a primary branch reference set for your origin remote.
Use:
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/{name_of_your_primary_branch}
to set the reference and then try rebasing again."
fi