Created
March 22, 2019 19:36
-
-
Save malte0811/d36ea2dedc345cf41e1363dc9da4f23d to your computer and use it in GitHub Desktop.
A simple script to undo and redo commits, since IntelliJ currently likes to mess up line endings
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
MESSAGE=$(git log -1 --format=%s) ; | |
git reset --soft HEAD~1 ; | |
FILES=$(git status --porcelain | grep -v "?? " | sed 's/^\w*\ */ /' | sed 's/->//g' | sed ':a;N;$!ba;s/\n//g') ; | |
echo Files: $FILES ; | |
echo Message: $MESSAGE ; | |
git reset HEAD $FILES ; | |
git add $FILES ; | |
git commit -m "$MESSAGE" ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment