-
-
Save eduardosilva/3a6dbbfdbb36a2f15f2c83bb2eab50e9 to your computer and use it in GitHub Desktop.
wip & rewip git alias
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
# This is Git's per-user configuration file. | |
[alias] | |
wip = "!sh -c \"WIP_STRING=\\\"wip: version\\\"; DEFAULT_VERSION=1; LAST_COMMIT_MSG=\\$(git log -1 --pretty=%B); LAST_VERSION=\\$(echo \\\"\\$LAST_COMMIT_MSG\\\" | grep -oP \\\"\\$WIP_STRING \\\\K\\\\d+\\\"); if [[ -z \\$LAST_VERSION ]]; then LAST_VERSION=\\$DEFAULT_VERSION; else LAST_VERSION=\\$((LAST_VERSION + 1)); fi; git add --all; git rm \\$(git ls-files --deleted) 2> /dev/null; git commit --message \\\"\\$WIP_STRING \\$LAST_VERSION\\\" --no-verify; echo \\\"wip commit created with version \\$LAST_VERSION\\\";\"" | |
rewip = !git rebase -i HEAD~$(git log --grep=\"^wip\" --format=%h | wc -l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment