Skip to content

Instantly share code, notes, and snippets.

@JHWelch
Created November 3, 2022 15:56
Show Gist options
  • Save JHWelch/b7397bf855111f50c8a343ffd9675242 to your computer and use it in GitHub Desktop.
Save JHWelch/b7397bf855111f50c8a343ffd9675242 to your computer and use it in GitHub Desktop.
Unwip
# 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