Created
September 12, 2014 15:12
-
-
Save virtualstaticvoid/f3ef72c052a8156d0929 to your computer and use it in GitHub Desktop.
Git script for resetting the file modes
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 sure we're at the root of git repo | |
if [ ! -d .git ]; then | |
echo "Error: must run this script from the root of a git repository" | |
exit 1 | |
fi | |
git diff --numstat \ | |
| awk '{if (($1 == "-" && $2 == "-") || ($1 == "0" && $2 == "0")) { $1=$2=""; print }}' \ | |
| sed 's/[^\ ].*/"&"/' \ | |
| xargs git checkout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment