1

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!

Community
  • 1
  • 1
  • 1
    Does this answer your question? [Git: list only "untracked" files (also, custom commands)](https://stackoverflow.com/questions/3801321/git-list-only-untracked-files-also-custom-commands) – phd Mar 14 '20 at 18:10
  • https://stackoverflow.com/search?q=%5Bgit%5D+list+untracked+files – phd Mar 14 '20 at 18:10

0 Answers0