Created
September 6, 2016 09:17
-
-
Save lengerfulluse/f84e1163fe1b7800ebb12cefda91445a to your computer and use it in GitHub Desktop.
git revert a specific file in a commit script
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 | |
function output_help { | |
echo "usage: git-revert-single-file <sha1> <file>" | |
} | |
sha1=$1 | |
file=$2 | |
if [[ $sha1 ]]; then | |
git diff $sha1..$sha1^ -- $file | patch -p1 | |
else | |
output_help | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment