Skip to content

Instantly share code, notes, and snippets.

@jason-witter
Last active January 30, 2023 20:34
Show Gist options
  • Save jason-witter/1009bdb75b415893f6be0c291ae76ebc to your computer and use it in GitHub Desktop.
Save jason-witter/1009bdb75b415893f6be0c291ae76ebc to your computer and use it in GitHub Desktop.
Rebase git command (primary branch agnostic)
function gr
set -l primary_branch (git symbolic-ref refs/remotes/origin/HEAD | sed 's+refs/remotes/origin/++')
git fetch
git add .
git commit -m "stuff"
git rebase -i "origin/$primary_branch"
git push -f
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment