Skip to content

Instantly share code, notes, and snippets.

@jinyongp
Last active June 22, 2022 04:55
Show Gist options
  • Save jinyongp/d8a4ce41e4bb52e352d45306691e3122 to your computer and use it in GitHub Desktop.
Save jinyongp/d8a4ce41e4bb52e352d45306691e3122 to your computer and use it in GitHub Desktop.
Git Templates
#!/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
#!/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