# git commit return code

3 messages from 2010-08-09 to 2010-08-10. Participants: Tomasz Pajor, Ævar Arnfjörð Bjarmason, Matthieu Moy.
Thread: https://gitlist.dev/t/24681

## Tomasz Pajor, 2010-08-09 15:32

Subject: git commit return code
Message-ID: <4C601F9B.6040102@puffy.pl>
URL: https://gitlist.dev/e/4C601F9B.6040102%40puffy.pl

```
Hello,

Is this proper behaviour:

root# su <username> -c "git commit --quiet -a -m \"templates generation\";"
# On branch master
nothing to commit (working directory clean)
root# echo $?
1

root# git --version
git version 1.7.1

```

## Ævar Arnfjörð Bjarmason, 2010-08-09 16:13

Subject: Re: git commit return code
Message-ID: <AANLkTi=HKBjT6=_RUNwPWJO-KsqgkjWUsxT_ontdvj6a@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3DHKBjT6%3D_RUNwPWJO-KsqgkjWUsxT_ontdvj6a%40mail.gmail.com
In-Reply-To: <4C601F9B.6040102@puffy.pl>

```
On Mon, Aug 9, 2010 at 15:32, Tomasz Pajor <nikon@puffy.pl> wrote:

> Is this proper behaviour:
>
> root# su <username> -c "git commit --quiet -a -m \"templates generation\";"
> # On branch master
> nothing to commit (working directory clean)
> root# echo $?
> 1

Yes, you asked it to create a commit, but there's nothing to commit.
Hence the failure to commit.

```

## Matthieu Moy, 2010-08-10 06:46

Subject: Re: git commit return code
Message-ID: <vpqr5i7q81k.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqr5i7q81k.fsf%40bauges.imag.fr
In-Reply-To: <4C601F9B.6040102@puffy.pl>

```
Tomasz Pajor <nikon@puffy.pl> writes:

> Hello,
>
> Is this proper behaviour:
>
> root# su <username> -c "git commit --quiet -a -m \"templates generation\";"
> # On branch master
> nothing to commit (working directory clean)
> root# echo $?
> 1

The exit status doesn't seem documented in the manpage, but it's
expected behavior that "git commit" refuses to create an empty commit,
and it seems sensible to "exit(1)" in this case.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```
