{"thread":{"id":"39335","subject":"Show all branches and ahead/behind states","startedAt":"2015-05-14T14:57:41Z","lastAt":"2015-05-15T16:59:13Z","messageCount":8,"participants":["Robert Dailey","Dennis Kaarsemaker","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"261235","messageId":"CAHd499AyEDNM7mDstFugD0Ah46=gAS=BRocDmpmOK-1k+qMCmw@mail.gmail.com","threadId":"39335","inReplyTo":null,"subject":"Show all branches and ahead/behind states","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-05-14T14:57:41Z","receivedAt":"2015-05-14T14:57:41Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"Is there a script or built-in functionality in git 2.4.1 that will\nallow me to list all local branches with the ahead and behind status\nof each? Basically the first line of:\n\n$ git status -sb\n\nBut for every branch would be roughly what I'm looking for. Any ideas? Thanks.\n"},{"id":"261236","messageId":"1431618938.31573.3.camel@kaarsemaker.net","threadId":"39335","inReplyTo":"CAHd499AyEDNM7mDstFugD0Ah46=gAS=BRocDmpmOK-1k+qMCmw@mail.gmail.com","subject":"Re: Show all branches and ahead/behind states","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2015-05-14T15:55:38Z","receivedAt":"2015-05-14T15:55:38Z","isPatch":false,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On do, 2015-05-14 at 09:57 -0500, Robert Dailey wrote:\n> Is there a script or built-in functionality in git 2.4.1 that will\n> allow me to list all local branches with the ahead and behind status\n> of each? Basically the first line of:\n> \n> $ git status -sb\n> \n> But for every branch would be roughly what I'm looking for. Any ideas? Thanks.\n\ngit branch -v (or -vv) is what you're after.\n-- \nDennis Kaarsemaker\nwww.kaarsemaker.net\n"},{"id":"261244","messageId":"CAHd499CQTW0J6ms+XYUBbyfT6gGKuiFFCiP57i8-eTwng+UzNQ@mail.gmail.com","threadId":"39335","inReplyTo":"1431618938.31573.3.camel@kaarsemaker.net","subject":"Re: Show all branches and ahead/behind states","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-05-14T17:18:58Z","receivedAt":"2015-05-14T17:18:58Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"On Thu, May 14, 2015 at 10:55 AM, Dennis Kaarsemaker\n<dennis@kaarsemaker.net> wrote:\n> On do, 2015-05-14 at 09:57 -0500, Robert Dailey wrote:\n>> Is there a script or built-in functionality in git 2.4.1 that will\n>> allow me to list all local branches with the ahead and behind status\n>> of each? Basically the first line of:\n>>\n>> $ git status -sb\n>>\n>> But for every branch would be roughly what I'm looking for. Any ideas? Thanks.\n>\n> git branch -v (or -vv) is what you're after.\n> --\n> Dennis Kaarsemaker\n> www.kaarsemaker.net\n>\n\nNice, I never noticed that -v showed ahead/behind status. Would be\nnice if branch had a --format option to customize the coloring of the\n\"ahead\" / \"behind\" text so that there was more contrast. It's a lot of\ninformation to consume especially with a lot of local branches;\ncoloring would bring some sanity.\n\nThanks!\n"},{"id":"261248","messageId":"1431624587.31573.5.camel@kaarsemaker.net","threadId":"39335","inReplyTo":"CAHd499CQTW0J6ms+XYUBbyfT6gGKuiFFCiP57i8-eTwng+UzNQ@mail.gmail.com","subject":"Re: Show all branches and ahead/behind states","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2015-05-14T17:29:47Z","receivedAt":"2015-05-14T17:29:47Z","isPatch":false,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On do, 2015-05-14 at 12:18 -0500, Robert Dailey wrote:\n> On Thu, May 14, 2015 at 10:55 AM, Dennis Kaarsemaker\n> <dennis@kaarsemaker.net> wrote:\n> > On do, 2015-05-14 at 09:57 -0500, Robert Dailey wrote:\n> >> Is there a script or built-in functionality in git 2.4.1 that will\n> >> allow me to list all local branches with the ahead and behind status\n> >> of each? Basically the first line of:\n> >>\n> >> $ git status -sb\n> >>\n> >> But for every branch would be roughly what I'm looking for. Any ideas? Thanks.\n> >\n> > git branch -v (or -vv) is what you're after.\n> > --\n> > Dennis Kaarsemaker\n> > www.kaarsemaker.net\n> >\n> \n> Nice, I never noticed that -v showed ahead/behind status. Would be\n> nice if branch had a --format option to customize the coloring of the\n> \"ahead\" / \"behind\" text so that there was more contrast. It's a lot of\n> information to consume especially with a lot of local branches;\n> coloring would bring some sanity.\n\nFortunately for you, git for-each-ref lets you do just this. For\nexample, this gives you what branch -vv does, minus coloration and\npadding:\n\ngit for-each-ref --format '%(HEAD) %(refname:short) %(upstream:short) %(upstream:track) %(subject)' refs/heads\n\n-- \nDennis Kaarsemaker\nwww.kaarsemaker.net\n"},{"id":"261256","messageId":"CAHd499BoApGJSM_qEKG8cHNOV_pOCyPRqEAXHo8iqYVg1LpGdw@mail.gmail.com","threadId":"39335","inReplyTo":"1431624587.31573.5.camel@kaarsemaker.net","subject":"Re: Show all branches and ahead/behind states","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-05-14T18:13:15Z","receivedAt":"2015-05-14T18:13:15Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"On Thu, May 14, 2015 at 12:29 PM, Dennis Kaarsemaker\n<dennis@kaarsemaker.net> wrote:\n> On do, 2015-05-14 at 12:18 -0500, Robert Dailey wrote:\n>> On Thu, May 14, 2015 at 10:55 AM, Dennis Kaarsemaker\n>> <dennis@kaarsemaker.net> wrote:\n>> > On do, 2015-05-14 at 09:57 -0500, Robert Dailey wrote:\n>> >> Is there a script or built-in functionality in git 2.4.1 that will\n>> >> allow me to list all local branches with the ahead and behind status\n>> >> of each? Basically the first line of:\n>> >>\n>> >> $ git status -sb\n>> >>\n>> >> But for every branch would be roughly what I'm looking for. Any ideas? Thanks.\n>> >\n>> > git branch -v (or -vv) is what you're after.\n>> > --\n>> > Dennis Kaarsemaker\n>> > www.kaarsemaker.net\n>> >\n>>\n>> Nice, I never noticed that -v showed ahead/behind status. Would be\n>> nice if branch had a --format option to customize the coloring of the\n>> \"ahead\" / \"behind\" text so that there was more contrast. It's a lot of\n>> information to consume especially with a lot of local branches;\n>> coloring would bring some sanity.\n>\n> Fortunately for you, git for-each-ref lets you do just this. For\n> example, this gives you what branch -vv does, minus coloration and\n> padding:\n>\n> git for-each-ref --format '%(HEAD) %(refname:short) %(upstream:short) %(upstream:track) %(subject)' refs/heads\n\nGreat idea. For some reason I can't apply coloring though:\n\nfor-each-ref --format '%(HEAD) %(refname:short) %C(bold\nblue)%(upstream:track)%C(reset)' refs/heads\n\nOutput:\n\nhotfix/4.2.3.1 %C(bold blue)[ahead 1, behind 1]%C(reset)\n"},{"id":"261314","messageId":"20150514223827.GB21149@peff.net","threadId":"39335","inReplyTo":"CAHd499BoApGJSM_qEKG8cHNOV_pOCyPRqEAXHo8iqYVg1LpGdw@mail.gmail.com","subject":"Re: Show all branches and ahead/behind states","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-14T22:38:27Z","receivedAt":"2015-05-14T22:38:27Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 14, 2015 at 01:13:15PM -0500, Robert Dailey wrote:\n\n> > git for-each-ref --format '%(HEAD) %(refname:short) %(upstream:short) %(upstream:track) %(subject)' refs/heads\n> \n> Great idea. For some reason I can't apply coloring though:\n> \n> for-each-ref --format '%(HEAD) %(refname:short) %C(bold\n> blue)%(upstream:track)%C(reset)' refs/heads\n> \n> Output:\n> \n> hotfix/4.2.3.1 %C(bold blue)[ahead 1, behind 1]%C(reset)\n\nIt's spelled \"%C(bold blue)\" in the --pretty formats, but in\nfor-each-ref, it's \"%(color:bold blue)\". Unifying these is one of those\nthings that has been on the radar for a long time, but nobody has quite\ngotten around to it.\n\n-Peff\n"},{"id":"261338","messageId":"CAHd499Am4PFo-YRJEbQfPqtk571f4eNr_gkdy-3ATzyvBcc-jw@mail.gmail.com","threadId":"39335","inReplyTo":"20150514223827.GB21149@peff.net","subject":"Re: Show all branches and ahead/behind states","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2015-05-15T14:25:22Z","receivedAt":"2015-05-15T14:25:22Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"On Thu, May 14, 2015 at 5:38 PM, Jeff King <peff@peff.net> wrote:\n> On Thu, May 14, 2015 at 01:13:15PM -0500, Robert Dailey wrote:\n>\n>> > git for-each-ref --format '%(HEAD) %(refname:short) %(upstream:short) %(upstream:track) %(subject)' refs/heads\n>>\n>> Great idea. For some reason I can't apply coloring though:\n>>\n>> for-each-ref --format '%(HEAD) %(refname:short) %C(bold\n>> blue)%(upstream:track)%C(reset)' refs/heads\n>>\n>> Output:\n>>\n>> hotfix/4.2.3.1 %C(bold blue)[ahead 1, behind 1]%C(reset)\n>\n> It's spelled \"%C(bold blue)\" in the --pretty formats, but in\n> for-each-ref, it's \"%(color:bold blue)\". Unifying these is one of those\n> things that has been on the radar for a long time, but nobody has quite\n> gotten around to it.\n>\n> -Peff\n\nThanks Jeff! That definitely fixed it. I was not able to find a\nreference for this in the git docs, maybe I just overlooked it\nsomewhere.\n\nAs a second query, is there a way to do column alignment? For example,\nI would like the ahead/behind status in one column, and the branch\nnames left aligned in a 2nd column. I can't simply use tabs here since\nthe length of column 1 may differ more greatly than a single tab\ncharacter.\n\nI imagine there is no built in way to do this, but just curious. I'd\nprobably end up having to write some complicated script :-(\n\nThanks again you've been super helpful.\n"},{"id":"261350","messageId":"20150515165912.GA26853@peff.net","threadId":"39335","inReplyTo":"CAHd499Am4PFo-YRJEbQfPqtk571f4eNr_gkdy-3ATzyvBcc-jw@mail.gmail.com","subject":"Re: Show all branches and ahead/behind states","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-15T16:59:13Z","receivedAt":"2015-05-15T16:59:13Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 15, 2015 at 09:25:22AM -0500, Robert Dailey wrote:\n\n> > It's spelled \"%C(bold blue)\" in the --pretty formats, but in\n> > for-each-ref, it's \"%(color:bold blue)\". Unifying these is one of those\n> > things that has been on the radar for a long time, but nobody has quite\n> > gotten around to it.\n> >\n> Thanks Jeff! That definitely fixed it. I was not able to find a\n> reference for this in the git docs, maybe I just overlooked it\n> somewhere.\n\nIt's in \"git help for-each-ref\" (see the section on \"FIELD NAMES\").\n\n> As a second query, is there a way to do column alignment? For example,\n> I would like the ahead/behind status in one column, and the branch\n> names left aligned in a 2nd column. I can't simply use tabs here since\n> the length of column 1 may differ more greatly than a single tab\n> character.\n\nThe \"--pretty\" format does have \"%<\" for doing printf-style alignment\n(see the \"PRETTY FORMATS\" section of \"git help log\"). But \"for-each-ref\"\ndoesn't have any similar facility, as far as I know.\n\nAgain, this is something that it would be nice to fix.\n\n-Peff\n"}]}