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 · 596 weeks and 1 day 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 · 484 weeks and 5 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 · 445 weeks and 5 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 · 38 weeks and 6 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 · 38 weeks and 5 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 · 38 weeks and 3 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 · 37 weeks and 3 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 · 37 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!.. coronavirus playa del carmen
bojokey283 · 37 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!.. covid isla mujeres
bojokey283 · 37 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. online marketing
bojokey283 · 36 weeks and 3 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 · 36 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!.. upholstery cleaning
bojokey283 · 36 weeks and 3 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 · 36 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. buy targeted traffic
bojokey283 · 35 weeks and 6 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 · 35 weeks and 5 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 · 33 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. schluesseldienst köln
bojokey283 · 33 weeks and 3 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 · 32 weeks 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 · 32 weeks 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 · 31 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. cenote manati
xoheko1229 · 30 weeks and 5 days ago
Thank you for this. It will be really helpful. white goods removal gold coast
FLM76 · 30 weeks and 4 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 · 30 weeks and 3 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 · 30 weeks 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 · 29 weeks and 4 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 · 29 weeks and 3 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 · 29 weeks and 2 days 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 · 28 weeks and 5 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 · 28 weeks and 4 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 · 28 weeks and 4 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 · 28 weeks and 3 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 · 28 weeks and 3 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 · 28 weeks and 2 days 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 · 28 weeks and 1 day 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 · 28 weeks and 1 day 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 · 28 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. holbox hotel
xoheko1229 · 28 weeks 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 · 27 weeks and 6 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 · 27 weeks and 6 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 · 26 weeks and 5 days ago
Great articles and great layout. Your blog post deserves all of the positive feedback it’s been getting. treatnheal
xoheko1229 · 26 weeks and 2 days 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 · 25 weeks and 6 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 · 25 weeks and 4 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 · 24 weeks and 6 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 · 24 weeks and 5 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 · 23 weeks and 6 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 · 23 weeks and 4 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 · 23 weeks and 4 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 · 23 weeks and 2 days 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 · 23 weeks and 2 days 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 · 22 weeks and 2 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. catering greek food
bojokey283 · 22 weeks and 2 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 cheap youtube views
bojokey283 · 21 weeks and 6 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 · 18 weeks and 3 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. Oriental Rug Cleaning
bojokey283 · 18 weeks 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 · 17 weeks and 4 days ago
Thanks for your information, it was really very helpfull.. cozumel diving
xoheko1229 · 17 weeks and 2 days ago
I gotta favorite this website it seems very helpful . Music producers in Cape Town
xoheko1229 · 16 weeks and 3 days 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 · 15 weeks and 3 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 · 15 weeks and 1 day 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 · 15 weeks 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 · 14 weeks and 5 days ago
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. Gestione documenti open source
xoheko1229 · 13 weeks and 4 days ago
<a href="https://www.google.com">wow</a>
joe_anderson2 · 13 weeks and 3 days ago
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. recruiting software
xoheko1229 · 13 weeks and 1 day ago
i am for the first time here. I found this board and I in finding It truly helpful & it helped me out a lot. I hope to present something back and help others such as you helped me. Business Influencer Australia
xoheko1229 · 12 weeks and 3 days ago
I'm glad I found this web site, I couldn't find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, i am always look for people to check out my web site. snorkel in cozumel
xoheko1229 · 12 weeks 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. Osteopathie
xoheko1229 · 11 weeks and 4 days ago
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!. Unabhängige Finanz Beratung
xoheko1229 · 11 weeks and 1 day 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. sports betting blog
xoheko1229 · 10 weeks 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. tulum all inclusive resort
xoheko1229 · 9 weeks 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. holbox resorts
xoheko1229 · 7 weeks and 5 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!.. https://healthytofitness.com/
xoheko1229 · 7 weeks and 4 days ago
I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me. lifestyleovy blog
xoheko1229 · 7 weeks and 3 days ago
I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. http://www.homeworkmaven.com/">read more
xoheko1229 · 7 weeks and 2 days ago
I like this post,And I guess that they having fun to read this post,they shall take a good site to make a information,thanks for sharing it to me. https://www.businessvaani.com
xoheko1229 · 6 weeks and 4 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. Job Search
xoheko1229 · 5 weeks and 5 days ago
If more people that write articles really concerned themselves with writing great content like you, more readers would be interested in their writings. Thank you for caring about your content. tulum resorts
xoheko1229 · 5 weeks and 5 days ago
Thanks for this great post, i find it very interesting and very well thought out and put together. I look forward to reading your work in the future. introverts definition
xoheko1229 · 5 weeks and 1 day 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. discounted cash flow valuation example
xoheko1229 · 4 weeks and 6 days ago
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!. iphone tips
xoheko1229 · 3 weeks and 3 days ago
Your work is very good and I appreciate you and hopping for some more informative posts. Thank you for sharing great information to us. perfect health
xoheko1229 · 2 weeks and 6 days ago
It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing. arete capital
xoheko1229 · 2 weeks and 5 days ago
I would like to say that this blog really convinced me to do it! Thanks, very good post. ind partners
xoheko1229 · 2 weeks and 4 days 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. read the article
xoheko1229 · 2 weeks and 2 days ago
Thank you for taking the time to publish this information very useful! https://www.clutchcityonline.com
xolabemo · 1 week and 2 days ago
I'm glad I found this web site, I couldn't find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, i am always look for people to check out my web site. SEQ Signs
xolabemo · 1 week and 2 days ago
I read that Post and got it fine and informative. https://www.rooferdesmoinesiowa.com
xolabemo · 4 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. Criminal defense lawyer
xolabemo · 19 hours 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: