I am trying to programmatically determine if there are any uncommitted changes within the git repo dir using: git diff and then determining whether there are changes or not from the exit code given. However, I am only able to do this by running the script from within the git dir, how would I be able to check git repos which are not in my current working directory? eg. git diff --dir=~/dir1/dir2/gitrepo/ if that makes sense.
Any help would be greatly appreciated, through any method :)