Skip to content

Instantly share code, notes, and snippets.

@staticfloat
Created February 17, 2023 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staticfloat/a578f9866bd2ea0649bd2e04093d3df2 to your computer and use it in GitHub Desktop.
Save staticfloat/a578f9866bd2ea0649bd2e04093d3df2 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Git rebase entire branch
grb()
{
if git show-ref --verify --quiet refs/remotes/origin/main; then
BASE=${1:-origin/main}
else
BASE=${1:-origin/master}
fi
FIRST_COMMIT=$(git merge-base ${BASE} HEAD)
git rebase -i ${FIRST_COMMIT}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment