* Show all branches and ahead/behind states @ 2015-05-14 14:57 Robert Dailey 2015-05-14 15:55 ` Dennis Kaarsemaker 0 siblings, 1 reply; 8+ messages in thread From: Robert Dailey @ 2015-05-14 14:57 UTC (permalink / raw) To: Git Is there a script or built-in functionality in git 2.4.1 that will allow me to list all local branches with the ahead and behind status of each? Basically the first line of: $ git status -sb But for every branch would be roughly what I'm looking for. Any ideas? Thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Show all branches and ahead/behind states 2015-05-14 14:57 Show all branches and ahead/behind states Robert Dailey @ 2015-05-14 15:55 ` Dennis Kaarsemaker 2015-05-14 17:18 ` Robert Dailey 0 siblings, 1 reply; 8+ messages in thread From: Dennis Kaarsemaker @ 2015-05-14 15:55 UTC (permalink / raw) To: Robert Dailey; +Cc: Git On do, 2015-05-14 at 09:57 -0500, Robert Dailey wrote: > Is there a script or built-in functionality in git 2.4.1 that will > allow me to list all local branches with the ahead and behind status > of each? Basically the first line of: > > $ git status -sb > > But for every branch would be roughly what I'm looking for. Any ideas? Thanks. git branch -v (or -vv) is what you're after. -- Dennis Kaarsemaker www.kaarsemaker.net ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Show all branches and ahead/behind states 2015-05-14 15:55 ` Dennis Kaarsemaker @ 2015-05-14 17:18 ` Robert Dailey 2015-05-14 17:29 ` Dennis Kaarsemaker 0 siblings, 1 reply; 8+ messages in thread From: Robert Dailey @ 2015-05-14 17:18 UTC (permalink / raw) To: Dennis Kaarsemaker; +Cc: Git On Thu, May 14, 2015 at 10:55 AM, Dennis Kaarsemaker <dennis@kaarsemaker.net> wrote: > On do, 2015-05-14 at 09:57 -0500, Robert Dailey wrote: >> Is there a script or built-in functionality in git 2.4.1 that will >> allow me to list all local branches with the ahead and behind status >> of each? Basically the first line of: >> >> $ git status -sb >> >> But for every branch would be roughly what I'm looking for. Any ideas? Thanks. > > git branch -v (or -vv) is what you're after. > -- > Dennis Kaarsemaker > www.kaarsemaker.net > Nice, I never noticed that -v showed ahead/behind status. Would be nice if branch had a --format option to customize the coloring of the "ahead" / "behind" text so that there was more contrast. It's a lot of information to consume especially with a lot of local branches; coloring would bring some sanity. Thanks! ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Show all branches and ahead/behind states 2015-05-14 17:18 ` Robert Dailey @ 2015-05-14 17:29 ` Dennis Kaarsemaker 2015-05-14 18:13 ` Robert Dailey 0 siblings, 1 reply; 8+ messages in thread From: Dennis Kaarsemaker @ 2015-05-14 17:29 UTC (permalink / raw) To: Robert Dailey; +Cc: Git On do, 2015-05-14 at 12:18 -0500, Robert Dailey wrote: > On Thu, May 14, 2015 at 10:55 AM, Dennis Kaarsemaker > <dennis@kaarsemaker.net> wrote: > > On do, 2015-05-14 at 09:57 -0500, Robert Dailey wrote: > >> Is there a script or built-in functionality in git 2.4.1 that will > >> allow me to list all local branches with the ahead and behind status > >> of each? Basically the first line of: > >> > >> $ git status -sb > >> > >> But for every branch would be roughly what I'm looking for. Any ideas? Thanks. > > > > git branch -v (or -vv) is what you're after. > > -- > > Dennis Kaarsemaker > > www.kaarsemaker.net > > > > Nice, I never noticed that -v showed ahead/behind status. Would be > nice if branch had a --format option to customize the coloring of the > "ahead" / "behind" text so that there was more contrast. It's a lot of > information to consume especially with a lot of local branches; > coloring would bring some sanity. Fortunately for you, git for-each-ref lets you do just this. For example, this gives you what branch -vv does, minus coloration and padding: git for-each-ref --format '%(HEAD) %(refname:short) %(upstream:short) %(upstream:track) %(subject)' refs/heads -- Dennis Kaarsemaker www.kaarsemaker.net ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Show all branches and ahead/behind states 2015-05-14 17:29 ` Dennis Kaarsemaker @ 2015-05-14 18:13 ` Robert Dailey 2015-05-14 22:38 ` Jeff King 0 siblings, 1 reply; 8+ messages in thread From: Robert Dailey @ 2015-05-14 18:13 UTC (permalink / raw) To: Dennis Kaarsemaker; +Cc: Git On Thu, May 14, 2015 at 12:29 PM, Dennis Kaarsemaker <dennis@kaarsemaker.net> wrote: > On do, 2015-05-14 at 12:18 -0500, Robert Dailey wrote: >> On Thu, May 14, 2015 at 10:55 AM, Dennis Kaarsemaker >> <dennis@kaarsemaker.net> wrote: >> > On do, 2015-05-14 at 09:57 -0500, Robert Dailey wrote: >> >> Is there a script or built-in functionality in git 2.4.1 that will >> >> allow me to list all local branches with the ahead and behind status >> >> of each? Basically the first line of: >> >> >> >> $ git status -sb >> >> >> >> But for every branch would be roughly what I'm looking for. Any ideas? Thanks. >> > >> > git branch -v (or -vv) is what you're after. >> > -- >> > Dennis Kaarsemaker >> > www.kaarsemaker.net >> > >> >> Nice, I never noticed that -v showed ahead/behind status. Would be >> nice if branch had a --format option to customize the coloring of the >> "ahead" / "behind" text so that there was more contrast. It's a lot of >> information to consume especially with a lot of local branches; >> coloring would bring some sanity. > > Fortunately for you, git for-each-ref lets you do just this. For > example, this gives you what branch -vv does, minus coloration and > padding: > > git for-each-ref --format '%(HEAD) %(refname:short) %(upstream:short) %(upstream:track) %(subject)' refs/heads Great idea. For some reason I can't apply coloring though: for-each-ref --format '%(HEAD) %(refname:short) %C(bold blue)%(upstream:track)%C(reset)' refs/heads Output: hotfix/4.2.3.1 %C(bold blue)[ahead 1, behind 1]%C(reset) ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Show all branches and ahead/behind states 2015-05-14 18:13 ` Robert Dailey @ 2015-05-14 22:38 ` Jeff King 2015-05-15 14:25 ` Robert Dailey 0 siblings, 1 reply; 8+ messages in thread From: Jeff King @ 2015-05-14 22:38 UTC (permalink / raw) To: Robert Dailey; +Cc: Dennis Kaarsemaker, Git On Thu, May 14, 2015 at 01:13:15PM -0500, Robert Dailey wrote: > > git for-each-ref --format '%(HEAD) %(refname:short) %(upstream:short) %(upstream:track) %(subject)' refs/heads > > Great idea. For some reason I can't apply coloring though: > > for-each-ref --format '%(HEAD) %(refname:short) %C(bold > blue)%(upstream:track)%C(reset)' refs/heads > > Output: > > hotfix/4.2.3.1 %C(bold blue)[ahead 1, behind 1]%C(reset) It's spelled "%C(bold blue)" in the --pretty formats, but in for-each-ref, it's "%(color:bold blue)". Unifying these is one of those things that has been on the radar for a long time, but nobody has quite gotten around to it. -Peff ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Show all branches and ahead/behind states 2015-05-14 22:38 ` Jeff King @ 2015-05-15 14:25 ` Robert Dailey 2015-05-15 16:59 ` Jeff King 0 siblings, 1 reply; 8+ messages in thread From: Robert Dailey @ 2015-05-15 14:25 UTC (permalink / raw) To: Jeff King; +Cc: Dennis Kaarsemaker, Git On Thu, May 14, 2015 at 5:38 PM, Jeff King <peff@peff.net> wrote: > On Thu, May 14, 2015 at 01:13:15PM -0500, Robert Dailey wrote: > >> > git for-each-ref --format '%(HEAD) %(refname:short) %(upstream:short) %(upstream:track) %(subject)' refs/heads >> >> Great idea. For some reason I can't apply coloring though: >> >> for-each-ref --format '%(HEAD) %(refname:short) %C(bold >> blue)%(upstream:track)%C(reset)' refs/heads >> >> Output: >> >> hotfix/4.2.3.1 %C(bold blue)[ahead 1, behind 1]%C(reset) > > It's spelled "%C(bold blue)" in the --pretty formats, but in > for-each-ref, it's "%(color:bold blue)". Unifying these is one of those > things that has been on the radar for a long time, but nobody has quite > gotten around to it. > > -Peff Thanks Jeff! That definitely fixed it. I was not able to find a reference for this in the git docs, maybe I just overlooked it somewhere. As a second query, is there a way to do column alignment? For example, I would like the ahead/behind status in one column, and the branch names left aligned in a 2nd column. I can't simply use tabs here since the length of column 1 may differ more greatly than a single tab character. I imagine there is no built in way to do this, but just curious. I'd probably end up having to write some complicated script :-( Thanks again you've been super helpful. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Show all branches and ahead/behind states 2015-05-15 14:25 ` Robert Dailey @ 2015-05-15 16:59 ` Jeff King 0 siblings, 0 replies; 8+ messages in thread From: Jeff King @ 2015-05-15 16:59 UTC (permalink / raw) To: Robert Dailey; +Cc: Dennis Kaarsemaker, Git On Fri, May 15, 2015 at 09:25:22AM -0500, Robert Dailey wrote: > > It's spelled "%C(bold blue)" in the --pretty formats, but in > > for-each-ref, it's "%(color:bold blue)". Unifying these is one of those > > things that has been on the radar for a long time, but nobody has quite > > gotten around to it. > > > Thanks Jeff! That definitely fixed it. I was not able to find a > reference for this in the git docs, maybe I just overlooked it > somewhere. It's in "git help for-each-ref" (see the section on "FIELD NAMES"). > As a second query, is there a way to do column alignment? For example, > I would like the ahead/behind status in one column, and the branch > names left aligned in a 2nd column. I can't simply use tabs here since > the length of column 1 may differ more greatly than a single tab > character. The "--pretty" format does have "%<" for doing printf-style alignment (see the "PRETTY FORMATS" section of "git help log"). But "for-each-ref" doesn't have any similar facility, as far as I know. Again, this is something that it would be nice to fix. -Peff ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-05-15 16:59 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-05-14 14:57 Show all branches and ahead/behind states Robert Dailey 2015-05-14 15:55 ` Dennis Kaarsemaker 2015-05-14 17:18 ` Robert Dailey 2015-05-14 17:29 ` Dennis Kaarsemaker 2015-05-14 18:13 ` Robert Dailey 2015-05-14 22:38 ` Jeff King 2015-05-15 14:25 ` Robert Dailey 2015-05-15 16:59 ` Jeff King
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.