Created
April 7, 2017 08:38
-
-
Save egnappahz/54da4f6daf000056e97fbc486a966958 to your computer and use it in GitHub Desktop.
timewarping with git
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 | |
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