This question is probably about bash as much as it is about git.
How do I run a command if there is nothing to commit? I did the following, but it runs the echo hello
command even if there is nothing to commit:
if git diff --exit-code; then
echo hello
fi
Coming from a python background, what I assumed would happen is if git ...
command is empty then the stuff inside the if statement would not execute. I have confirmed that git diff --exit-code
returns nothing.