{"id":225,"date":"2017-09-06T01:36:39","date_gmt":"2017-09-06T01:36:39","guid":{"rendered":"http:\/\/linux.suriyasuneel.com\/?p=225"},"modified":"2017-09-06T01:39:05","modified_gmt":"2017-09-06T01:39:05","slug":"find-the-recent-git-branch","status":"publish","type":"post","link":"http:\/\/linux.suriyasuneel.com\/?p=225","title":{"rendered":"Find the recent git branch"},"content":{"rendered":"<h2>Find all the commits to the git repo<\/h2>\n<p>You have a git repo but don&#8217;t have any idea what the most recent git branch. You can find it from the git repo.<br \/>\nIn my case i have access to the git repo in my linux machine as follows<\/p>\n<pre>\/home\/git\/my_lib.git<\/pre>\n<p>Once you are in the folder issue the following command<\/p>\n<pre>git for-each-ref --sort=-committerdate refs\/heads<\/pre>\n<p>the output will look like this<\/p>\n<pre>093ae543bf40e3394c95b75074d1c87f1ccd248a commit\trefs\/heads\/br_11_20_2013\r\n10d8be135e15b40cdf62dbf212c4768c2b4b2cab commit\trefs\/heads\/master\r\ne9e0cb4ac232207c970d660e08ca7214db21efd8 commit\trefs\/heads\/br_5_17_2013\r\n3c123ae255e9b4ec9850a889de9f3dfbb6766c1f commit\trefs\/heads\/br_4_24_2013\r\nea16d0a376c125aa1a47647a562ec74212801923 commit\trefs\/heads\/br_11_24_2012\r\n427ad84f7f9dbef690bd875550045f02b6344736 commit\trefs\/heads\/br_10_25_2012\r\n35aba3460091b7d4bad8a6ca102061e21d2cb404 commit\trefs\/heads\/br_8_19_2012\r\n15c2db0c9289db380127d54c9ad341ece86532c7 commit\trefs\/heads\/br_5_18_2012\r\n<\/pre>\n<p>Now based on the output, the most recent branch is br_11_20_2013<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Find all the commits to the git repo You have a git repo but don&#8217;t have any idea what the most recent git branch. You can find it from the git repo. In my case i have access to the git repo in my linux machine as follows \/home\/git\/my_lib.git Once you are in the folder [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/225"}],"collection":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=225"}],"version-history":[{"count":1,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/225\/revisions"}],"predecessor-version":[{"id":226,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=\/wp\/v2\/posts\/225\/revisions\/226"}],"wp:attachment":[{"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/linux.suriyasuneel.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}