Last active
August 22, 2019 20:39
-
-
Save Manishearth/fb2caccbadf4aa683fa2a7496dfbfee3 to your computer and use it in GitHub Desktop.
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 | |
# Make it exit early if there's an error | |
set -e | |
# cd git root | |
pushd $(git rev-parse --show-toplevel) >/dev/null | |
PINKY_FILE=$(git rev-parse --git-path pinky) | |
# Create a new scratch index based on the existing index | |
cp $(git rev-parse --git-path index) ${PINKY_FILE} | |
# Add all files to scratch index. Use -u if you don't want to include untracked files | |
GIT_INDEX_FILE=${PINKY_FILE} git add . | |
# Write pinky index to a tree object, create a commit from it with parent=HEAD | |
echo "jane" | git commit-tree $(GIT_INDEX_FILE=${PINKY_FILE} git write-tree) -p @ | |
# Clean up | |
rm ${PINKY_FILE} | |
# cd back | |
popd >/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment