Last active
May 29, 2024 13:10
-
-
Save danielroe/6b03b38d60c00d476f673bad28678559 to your computer and use it in GitHub Desktop.
rebase/merge .zshrc commands
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
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