Summary
I'm trying to figure out how to detect when my repo has untracked files (Either when I rename, move, or delete a file/ folder) to return exit code 0 to trigger a Hazel Rule rule on my mac. I've been trying to research a way to return something parable using git status --porcelain
which seems to only trigger the exit code when a file is modified NOT when it loses tracking.
What I Have Tried
I've used this if [[`git status --porcelain`]||[git `status --untracked-files`]];
but doesn't work I guess because of the --untracked-files isn't parable?
Below is the current script I have.
#!/bin/bash
check(){
if [[ `git status --porcelain` ]];
then
# Changes
echo "Changes being committed..."
return 0
else
# No Changes
echo "No changes to commit..."
return 1
fi
}
Does anyone have any ideas?
Thanks!