1 $ git status
2 # On branch master
3 nothing to commit (working directory clean)
4 $ echo $?
5 1

Shouldn’t a successful git status in a git repository return a status code of 0 ? Doing it in a random folder returns a sensible value:

1 $ git status
2 fatal: Not a git repository
3 Failed to find a valid git directory.
4 $ echo $?
5 128

Can anybody shed some light on this ?

I found Possible bug in ‘git status’ exit code is 1 instead of 0. What is the rational for this ? It goes against everything Unix ?!?


Your Host

A picture of me

I am François Beausoleil, a Ruby on Rails and Scala developer. During the day, I work on Seevibes, a platform to measure social interactions related to TV shows. At night, I am interested many things. Read my biography.

Top Tags

Books I read and recommend


Projects I work on

Projects I worked on