Skip to content

Instantly share code, notes, and snippets.

@egnappahz
Created April 7, 2017 08:38
Show Gist options
  • Save egnappahz/54da4f6daf000056e97fbc486a966958 to your computer and use it in GitHub Desktop.
Save egnappahz/54da4f6daf000056e97fbc486a966958 to your computer and use it in GitHub Desktop.
timewarping with git
#!/bin/bash
uncached=$(git diff --cached)
echo $uncached
if [ "$uncached" == "" ]; then
read -p "There is no cachediffrence, you probably already comitted. Do you want to DESTROY the last commit?? Type yes: " yes
if [ "$yes" == "yes" ]; then
git reset --hard HEAD~1
fi
else
read -p "There is a cachediffrence, you probably added the files but didnt commit them. Do you want to DESTROY the uncommited files ?? Type yes: " yes
if [ "$yes" == "yes" ]; then
git stash -u
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment