Skip to content

Instantly share code, notes, and snippets.

@guizmaii
Created August 18, 2025 01:39
Show Gist options
  • Save guizmaii/6762ff3aef0708d1e90672370bb54292 to your computer and use it in GitHub Desktop.
Save guizmaii/6762ff3aef0708d1e90672370bb54292 to your computer and use it in GitHub Desktop.
grbb
# Usage:
# In a git-tracked directory, when on a branch A and you want to rebase it on branch B:
#
# $ grbb B
#
function grbb {
# shellcheck disable=SC2154
local currentBranch
currentBranch=$(git branch --show-current)
git checkout "$1"
git pull
git checkout "${currentBranch}"
git pull
git rebase "$1"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment