Created
July 1, 2012 08:00
-
-
Save ku/3027463 to your computer and use it in GitHub Desktop.
remove git untracked files
This file contains hidden or 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/sh | |
| dir=`pwd` | |
| while true ; do | |
| if test -d "$dir/.git" | |
| then | |
| break | |
| else | |
| dir=`dirname $dir` | |
| if test "$dir" = "/" | |
| then | |
| exit 1 | |
| fi | |
| fi | |
| done | |
| files=`git status --porcelain | egrep '^\?\?' | cut -f 2 -d ' '` | |
| for file in $files | |
| do | |
| rm -f "$dir/$file" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment