Created
April 17, 2014 14:03
-
-
Save oh-sky/10985890 to your computer and use it in GitHub Desktop.
.gitignoreに書いてあるけれどもインデックスされているファイルの一覧を取得する ref: http://qiita.com/oh-sky@github/items/fc91dc50967e020229ca
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 | |
GITIGNOREPATH=`git rev-parse --show-toplevel`'/.gitignore' | |
if [ $? -ne 0 ] | |
then | |
exit $? | |
fi | |
if [ ! -f $GITIGNOREPATH ] | |
then | |
echo $GITIGNOREPATH' does not exist.' | |
exit 1 | |
fi | |
for indexed in `git ls-files` | |
do | |
for ignored in `cat ${GITIGNOREPATH} | grep -v '^#'` | |
do | |
if [ `echo /${indexed} | grep -F ${ignored}` ] | |
then | |
echo $indexed | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment