Last active
July 29, 2020 17:23
-
-
Save dkua/2048b941b16860d7ca18dec38ba704c7 to your computer and use it in GitHub Desktop.
safebase – git alias for backing up branch before rebasing
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
[alias] | |
# Returns name of current branch | |
# Usage: git current | |
current = rev-parse --abbrev-ref HEAD | |
# Makes a full copy of the current branch with `backup.<epoch>` appended before doing an interactive rebase | |
# Usage: git safebase HEAD~2 | |
safebase = !CURRENT=$(git current) && git branch -c $CURRENT $CURRENT.backup.$(date +%s) && git rebase -i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment