Created
November 3, 2022 15:56
-
-
Save JHWelch/b7397bf855111f50c8a343ffd9675242 to your computer and use it in GitHub Desktop.
Unwip
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
# Undoes all WIP commits, will stop at last non-wip commit. | |
unwip () { | |
lastCommit=$(git log -1 --pretty=%B | cat) | |
if [ ${lastCommit:l} != "wip" ]; then | |
echo "Last commit is not a WIP." | |
else | |
count=0 | |
while [ ${lastCommit:l} = "wip" ] | |
do | |
git reset HEAD~ | |
lastCommit=$(git log -1 --pretty=%B | cat) | |
((count=count+1)) | |
done | |
echo "Undid $count 'WIP' commits." | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment