ladder
ladder

Reputation: 249

Is there a Git Hook for "git status"?

I'm writing a CLI and I'd like to run something anytime the user checks "git status". Is this possible? From what I've read there does not exist a hook for this. Is there a possible workaround?

Upvotes: 1

Views: 326

Answers (1)

Caleb
Caleb

Reputation: 125037

No.

There's a complete list of available hooks in the git documentation, and I don't see one there for status. That makes sense, since hooks are usually used to take some action before or after changes are made to the local repository. git status doesn't change the state of the repository at all, so there's less reason to run a hook when that command runs.

That said, it's possible to create your own git commands by putting an executable file named git-xxx, where xxx is your command name, somewhere in your path. So if you want the status reported differently, you could just create git-mystatus to do what you want.

Upvotes: 2

Related Questions