Yash
Yash

Reputation: 3114

git diff command to exclude certain file types while checking for trailing white space errors

I want to check trailing white space errors between two git commits and the following commands works fine for me:

git diff ${prev_commit_ID}..${current_commit_ID} --check --relative

Please help me to modify this command to exclude some file types such as *.txt, *.pl, *.groovy etc.

Upvotes: 1

Views: 712

Answers (1)

ElpieKay
ElpieKay

Reputation: 30888

git diff ${prev_commit_ID}..${current_commit_ID} --check --relative -- . ':!*.txt' ':!*.pl' ':*.groovy'

. means all the files under the directory.

:!*.txt exclude .txt files.

Upvotes: 1

Related Questions