Seamus
Seamus

Reputation: 2101

Ignore git show errors

I'm writing a script that calls git show a bunch of times. Sometimes, it calls git show $COMMIT:$FILE on $FILE that doesn't exist in $COMMIT. This prints an error to the terminal. Normally this would be the right thing, but for the moment, I'm not bothered about this. (The script works fine even when this happens). So is there a way to just suppress errors from git? I couldn't find a flag…

Upvotes: 1

Views: 864

Answers (1)

dusan
dusan

Reputation: 9273

I think there's no git show flag that allows that.

Just redirect the error output inside your script:

git show $COMMIT:$FILE 2> /dev/null

Upvotes: 2

Related Questions