joe
joe

Reputation: 71

git: which remote git branch had the last commit?

I am attempting to figure out which remote branch was most recently updated. Something like 'git show-ref' but in chronological order would be good enough. How do I go about doing this?

Upvotes: 2

Views: 174

Answers (3)

Jakub Narębski
Jakub Narębski

Reputation: 323404

Use git for-each-ref, e.g.:

$ git for-each-ref --format='%(committerdate)%09%(refname)' \
  --sort=-committerdate refs/remotes/
2010-10-21 21:50:30 +0200       refs/remotes/git/trast/t/doc-config-extraction-v2
2010-09-23 17:40:05 -0700       refs/remotes/gitweb-kernel.org/master
2010-07-16 11:49:38 +0530       refs/remotes/gsoc2010/gitweb-write/master
2010-06-13 21:02:44 -0700       refs/remotes/gsoc2010/gitweb-write/next
2010-06-08 05:54:00 +0000       refs/remotes/gsoc2010/gitweb-write/man
2010-06-08 05:53:58 +0000       refs/remotes/gsoc2010/gitweb-write/html
2010-06-07 22:16:45 -0700       refs/remotes/gsoc2010/gitweb-write/pu
2010-06-07 15:50:21 -0700       refs/remotes/gsoc2010/gitweb-write/maint
2010-06-02 16:16:06 -0700       refs/remotes/gsoc2010/gitweb-write/todo
2010-01-13 17:06:29 -0800       refs/remotes/gitweb-kernel.org/gitweb-ml-v5

Upvotes: 2

seriyPS
seriyPS

Reputation: 7102

also if you has GUI, you can use gitk for observe all branches in GUI

Upvotes: 0

MForster
MForster

Reputation: 9376

How about a little bash scripting?

>> git show-ref | while read sha1 ref; do echo $(git log --pretty=format:%ai -1 $sha1) $ref ; done | sort
2010-10-23 15:30:57 +0200 refs/remotes/mambo/mambo
2010-10-23 15:30:57 +0200 refs/remotes/mambo/master
2010-10-29 22:38:23 +0200 refs/heads/master
2010-10-29 22:38:23 +0200 refs/remotes/nas/HEAD
2010-10-29 22:38:23 +0200 refs/remotes/nas/master

Upvotes: 2

Related Questions