Skip to content

Instantly share code, notes, and snippets.

@Serchinastico
Last active June 5, 2018 17:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Serchinastico/98cea9fcc2733689e63c57191257bd2c to your computer and use it in GitHub Desktop.
Save Serchinastico/98cea9fcc2733689e63c57191257bd2c to your computer and use it in GitHub Desktop.
Alias for easier git rebase --onto
[alias]
# ronto stands for "rebase --onto". Uses the current branch to move it and updates the start-of-the-branch tag along
ronto = "!f() { \
git rebase --onto $1 __start__$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --abbrev-ref HEAD); \
git tag -d __start__$(git rev-parse --abbrev-ref HEAD); \
git tag __start__$(git rev-parse --abbrev-ref HEAD) $1; \
}; f"
# nb stands for "create branch". Creates a tag marking the start-of-the-branch
cb = "!f() { \
git tag __start__$1; \
git checkout -b $1; \
}; f"
# db stands for "delete branch". Deletes the tag and the branch itself
db = "!f() { \
git tag -d __start__$1; \
git branch -D $1; \
}; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment