Show git branches by date - useful for showing active branches

for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r
Print out list of all branches with last commit date to the branch, including relative time since commit and color coding.
Sample Output
2009-06-03 12:21:35 +0900 3 hours ago	add_cool_functionality
2009-06-02 16:15:13 +0900 24 hours ago	remove_strange_bug
2009-06-02 16:12:20 +0900 24 hours ago	implement_observer
2009-06-02 14:42:58 +0900 25 hours ago	experiment_with_bobcat_feature

16
By: brunost
2009-06-03 08:25:00

8 Alternatives + Submit Alt

What Others Think

Is there a good way to add that to the git alias?
youthenme · 582 weeks ago
You can't add it as a git alias because it's using a bash for loop to run the command several times. What you can do is add a script at /usr/local/bin/git-branch-dates containing: #!/bin/bash for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k|head -n 1`\\t$k;done|sort -r Git automatically searches through any bash scripts on your path that start with git- so you can now run: git branch-dates and the script will be run.
unixmonkey36469 · 470 weeks and 4 days ago
Of course you can add it as a git alias! A git alias which is "!f() { ...bash script here...; }; f" works just fine. So, if you add an alias which says brel = "!f() { for k in `git branch|perl -pe s/^..//`;do echo -e `git show --pretty=format:'%Cgreen%ci %Cblue%cr%Creset' $k|head -n 1` \\\t$k; done | sort -r; }; f" git brel will do the proper thing. Of course, the single command git for-each-ref --sort=-committerdate --format='%1B[32m%(committerdate:iso8601) %1B[34m%(committerdate:relative) %1B[0;m%(refname:short)' refs/heads/ is easier to alias :)
mstormo · 431 weeks and 4 days ago
You’ve got some interesting points in this article. I would have never considered any of these if I didn’t come across this. Thanks!. click" rel="nofollow">http://libjournal.uncg.edu/ap/user/viewPublicProfile/5446'>click this site
bojokey283 · 24 weeks and 5 days ago
i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.. look at this http://personeriadebarranquilla.gov.co/?option=com_k2&view=itemlist&task=user&id=3107
bojokey283 · 24 weeks and 4 days ago
I felt very happy while reading this site. This was really very informative site for me. I really liked it. This was really a cordial post. Thanks a lot!. read more http://libjournal.uncg.edu/ap/user/viewPublicProfile/5446
xoheko1229 · 24 weeks and 2 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. forex
bojokey283 · 23 weeks and 2 days ago
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. blinds installation
bojokey283 · 23 weeks and 2 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. coronavirus playa del carmen
bojokey283 · 23 weeks and 1 day ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. covid isla mujeres
bojokey283 · 23 weeks and 1 day ago
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. online marketing
bojokey283 · 22 weeks and 2 days ago
Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. house clearance bridgend
bojokey283 · 22 weeks and 2 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. upholstery cleaning
bojokey283 · 22 weeks and 2 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. taco catering
bojokey283 · 22 weeks and 1 day ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. buy targeted traffic
bojokey283 · 21 weeks and 5 days ago
I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!.. Turmeric Essential Oil
bojokey283 · 21 weeks and 4 days ago
Your content is nothing short of brilliant in many ways. I think this is engaging and eye-opening material. Thank you so much for caring about your content and your readers. tulum mexico weather
bojokey283 · 19 weeks and 4 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. schluesseldienst köln
bojokey283 · 19 weeks and 2 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. cancun
bojokey283 · 17 weeks and 6 days ago
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing tulum
bojokey283 · 17 weeks and 6 days ago
I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. korrekt ügyvéd Debrecen
bojokey283 · 17 weeks and 1 day ago
Thanks for every other informative site. The place else may just I get that kind of information written in such an ideal means? I have a venture that I’m just now operating on, and I have been on the look out for such information. cenote manati
xoheko1229 · 16 weeks and 4 days ago
Thank you for this. It will be really helpful. white goods removal gold coast
FLM76 · 16 weeks and 2 days ago
Really a great addition. I have read this marvelous post. Thanks for sharing information about it. I really like that. Thanks so lot for your convene. otomatisasi rumah https://www.tiscontrol.com/tptis/id/index.html
bojokey283 · 16 weeks and 2 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. otomatisasi rumah
bojokey283 · 15 weeks and 6 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. jelent?s pályázatírás Debrecen
bojokey283 · 15 weeks and 3 days ago
I read a article under the same title some time ago, but this articles quality is much, much better. How you do this.. best beach in cozumel
xoheko1229 · 15 weeks and 2 days ago
Thanks for every other informative site. The place else may just I get that kind of information written in such an ideal means? I have a venture that I’m just now operating on, and I have been on the look out for such information. reefs in cozumel
xoheko1229 · 15 weeks and 1 day ago
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. must do in tulum
xoheko1229 · 14 weeks and 4 days ago
I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best! tulum ruins
xoheko1229 · 14 weeks and 3 days ago
This article is an appealing wealth of informative data that is interesting and well-written. I commend your hard work on this and thank you for this information. You’ve got what it takes to get attention. best places to stay in cancun
xoheko1229 · 14 weeks and 3 days ago
Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. best places to eat in cancun
xoheko1229 · 14 weeks and 2 days ago
Great post, you have pointed out some fantastic points , I likewise think this s a very wonderful website. must do in cancun
xoheko1229 · 14 weeks and 2 days ago
Nice post. I was checking constantly this blog and I’m impressed! Extremely useful info specially the last part I care for such information a lot. I was seeking this certain info for a long time. Thank you and good luck. restaurant in playa del carmen
xoheko1229 · 14 weeks and 1 day ago
Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!THANKS!!!!!! isla mujeres weather
xoheko1229 · 14 weeks ago
I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog, I will keep visiting this blog very often. best places to stay in isla mujeres
xoheko1229 · 13 weeks and 6 days ago
This is just the information I am finding everywhere. Thanks for your blog, I just subscribe your blog. This is a nice blog.. holbox mexico
xoheko1229 · 13 weeks and 6 days ago
I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. holbox hotel
xoheko1229 · 13 weeks and 6 days ago
This is my first time visit here. From the tons of comments on your articles,I guess I am not only one having all the enjoyment right here! isla contoy tour
xoheko1229 · 13 weeks and 5 days ago
useful information on topics that plenty are interested on for this wonderful post.Admiring the time and effort you put into your b!.. isla contoy tour
xoheko1229 · 13 weeks and 5 days ago
Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging, treatnheal
xoheko1229 · 12 weeks and 3 days ago
Great articles and great layout. Your blog post deserves all of the positive feedback it’s been getting. treatnheal
xoheko1229 · 12 weeks ago
This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. Inteligentny dom
xoheko1229 · 11 weeks and 5 days ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. Automatyka hoteli
bojokey283 · 11 weeks and 3 days ago
Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!.. unique bathroom vanity
bojokey283 · 10 weeks and 5 days ago
Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place.. luxury bathroom vanity
bojokey283 · 10 weeks and 4 days ago
Thanks for your post. I’ve been thinking about writing a very comparable post over the last couple of weeks, I’ll probably keep it short and sweet and link to this instead if thats cool. Thanks. luxury hotel tulum mexico
xoheko1229 · 9 weeks and 5 days ago
Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! covid cancun
bojokey283 · 9 weeks and 3 days ago
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. covid playa del carmen
bojokey283 · 9 weeks and 3 days ago
I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. Hualien restaurants
xoheko1229 · 9 weeks and 1 day ago
I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post. Hualien
bojokey283 · 9 weeks ago
I high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information? Mediterranean food catering
xoheko1229 · 8 weeks and 1 day ago
I know your expertise on this. I must say we should have an online discussion on this. Writing only comments will close the discussion straight away! And will restrict the benefits from this information. catering greek food
bojokey283 · 8 weeks and 1 day ago
Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing cheap youtube views
bojokey283 · 7 weeks and 5 days ago
Wonderful article, thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here. RC toy car
xoheko1229 · 4 weeks and 1 day ago
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. Oriental Rug Cleaning
bojokey283 · 3 weeks and 5 days ago
I know your expertise on this. I must say we should have an online discussion on this. Writing only comments will close the discussion straight away! And will restrict the benefits from this information. RC toy car
bojokey283 · 3 weeks and 2 days ago
Thanks for your information, it was really very helpfull.. cozumel diving
xoheko1229 · 3 weeks and 1 day ago
I gotta favorite this website it seems very helpful . Music producers in Cape Town
xoheko1229 · 2 weeks and 1 day ago
Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work. cozumel snorkeling
xoheko1229 · 1 week and 2 days ago
Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it's quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards, http://www.gtechoh.com/">Slab leak detection
xoheko1229 · 1 week ago
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. https://europa-road.eu/hu/mobilhaz-szallitas-kulfoldrol-es-belfoldon.php
xoheko1229 · 6 days ago
This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free. It is the old what goes around comes around routine. Boat Charters St Thomas
xoheko1229 · 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: