Created
March 8, 2019 03:58
-
-
Save jrodbx/dcc81cb213e4c300c0e1ddfde4ae553d to your computer and use it in GitHub Desktop.
Hack to enable better Java to Kotlin diffs
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
#!/usr/bin/env bash | |
# Find all added *.kt files from last commit and mv to *.java | |
for f in $(git diff --name-status --diff-filter='A' HEAD~ "*.kt" | cut -f 2); | |
do mv -- "$f" "${f%.kt}.java"; | |
done | |
# Commit the kt to java changes | |
git add . | |
git commit -m"kt to java" | |
# Revert, but stash before committing | |
git revert --no-commit HEAD | |
git stash | |
# Squash the java change into the original commit | |
git reset --soft HEAD~ | |
git commit --amend --no-edit | |
# Pop the stashed revert changes and commit | |
git stash pop | |
git commit -am"java to kt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment