Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
.gitignoreに書いてあるけれどもインデックスされているファイルの一覧を取得する ref: http://qiita.com/oh-sky@github/items/fc91dc50967e020229ca
#!/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
You can’t perform that action at this time.