Last active
June 22, 2022 04:55
-
-
Save jinyongp/d8a4ce41e4bb52e352d45306691e3122 to your computer and use it in GitHub Desktop.
Git Templates
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
#!/bin/bash | |
set -e | |
while [[ $(git --no-pager show --pretty=format:"%s" -s) =~ ^--wip-- ]]; do | |
echo -e '\033[32mWIP Commit Detected.\033[0m' | |
echo "" | |
git --no-pager diff HEAD^1 HEAD --stat | |
echo "" | |
read -p "UNWIP? (Y/n) " answer < /dev/tty | |
case $answer in | |
y | yes | '') | |
git reset HEAD~1 | |
echo -e '\033[32mUNWIP Completed\033[0m' | |
;; | |
n | no) | |
echo 'Do nothing.' | |
break | |
;; | |
*) | |
echo -e '\033[1;33mY or n (default "y")\033[0m' | |
continue | |
;; | |
esac | |
done | |
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
#!/bin/bash | |
set -e | |
while [[ $(git --no-pager show --pretty=format:"%s" -s) =~ ^--wip-- ]]; do | |
echo -e '\033[32mWIP Commit Detected.\033[0m' | |
echo "" | |
git --no-pager diff HEAD^1 HEAD --stat | |
echo "" | |
read -p "UNWIP? (Y/n) " answer < /dev/tty | |
case $answer in | |
y | yes | '') | |
git reset HEAD~1 | |
echo -e '\033[32mUNWIP Completed\033[0m' | |
;; | |
n | no) | |
echo 'Do nothing.' | |
break | |
;; | |
*) | |
echo -e '\033[1;33mY or n (default "y")\033[0m' | |
continue | |
;; | |
esac | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment