On Wed, 15 May 2013 18:53:10 -0500 John McKown <john.archie.mck...@gmail.com> wrote:
> > If I run "git commit", Git will output a lot of detailed information > > about the commit: > > > > $ git commit -m 'Daily update.' > > [master bb56ea6] Daily update. > > 1477 files changed, 183898 insertions(+), 8 deletions(-) > > rewrite GTD/Email.ods (72%) > > create mode 120000 [etc.] > > $ > > > > If I run "git commit -q", Git will output nothing: > > > > $ git commit -m 'Daily update.' > > $ > > > > Is there an option to get "git commit" to output just the first > > line, giving the commit hash, like this: > > > > $ git commit -m 'Daily update.' > > [master bb56ea6] Daily update. > > $ > > > Cheat? > > git commit -m 'Daily commit' | head -n 1 I would do git commit -q -m 'Daily commit' && git rev-parse HEAD instead. It's two calls, but the second one specifically designed to get the latest commit ID. A possible downside is that if the repository is shared in some way (say, it's on a networked share) then there's a possible race between these adjacent calls to the git binary -- another developer is able to update the HEAD (or a branch it points to) in the meantime. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.