Skip to content

Instantly share code, notes, and snippets.

@danielroe
Last active May 29, 2024 13:10
Show Gist options
  • Save danielroe/6b03b38d60c00d476f673bad28678559 to your computer and use it in GitHub Desktop.
Save danielroe/6b03b38d60c00d476f673bad28678559 to your computer and use it in GitHub Desktop.
rebase/merge .zshrc commands
rebase_or_merge () {
local branch=${1:-$(git config --get init.defaultBranch)}
local remote=${$(git remote | grep '^upstream$'):-origin}
git fetch $remote
git $CMD $remote/$branch
}
# Usage: merge <branch>
merge () {
CMD=merge rebase_or_merge
}
# Usage: rebase <branch>
rebase () {
CMD=rebase rebase_or_merge
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment