Skip to content

Instantly share code, notes, and snippets.

@bill-auger
Forked from jehiah/git-branch-status
Last active February 11, 2021 16:59
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save bill-auger/9335fe2633eae38d3070 to your computer and use it in GitHub Desktop.
Save bill-auger/9335fe2633eae38d3070 to your computer and use it in GitHub Desktop.
moved to github --> https://github.com/bill-auger/git-branch-status/
@Eldelshell
Copy link

+1 Love it!

@knovoselic
Copy link

Great job, thanks for sharing!

@bill-auger
Copy link
Author

oh hey fellas glad yas like it - i find this script immensely helpful so i was compelled to enhance it

sry i didnt see the comments earlier - apparently github does not notify anyone of comments to gists

anyways i came back today because i made some additions

my original modifications

  • prettified into columns with adjustable max wdith
  • added ability to filter by branch name and to show locals
  • removed the temp file i/o - runs fully in memory
  • added command-line switches and usage message

this update

  • added '*' indicator near current branch
  • added dates of the last commit beside each branch and upstream

below is a screenshot of the latest version

alt text

@kierun
Copy link

kierun commented Jul 22, 2015

You just saved me a day's work, thank you! ^_~

Copy link

ghost commented Oct 19, 2015

Awesome, but doesn't appear the --dates flag can be used with the --all flag :(

@bill-auger
Copy link
Author

@ava-dylang - yes the cli parsing is very crude and that is preciecely why i added the -v --verbose switch for now - see USAGE above or branch-status --help

@bill-auger
Copy link
Author

new version

  • added --remotes CLI switch for listing all remotes (also -a and --all)

@mikea
Copy link

mikea commented Mar 24, 2016

For some reason this script replace '_' in branch name by space. Is this intentional? Can it be fixed?

$ git branch
  arcpatch-D18103
  common_flags
  fuzzer_asan_option
  fuzzer_experiments
  fuzzer_weighted_rnd
  libfuzzer_arbitrary_fun
  libfuzzer_buildgn
  libfuzzer_custom_mutator
  master
  reading_fix
  sancov_cfg
  sancov_dominators
  sancov_frontier
  sancov_function_pct
  sancov_module_style
* sancov_stats
  santizer_coverage_pass_dep
  stl_extra

$ git branch-status -a

  local <-> upstream
  ---------------------------------------------------------------------------
  | arcpatch-D18103            | n/a           | n/a        | (no upstream) |
  | common flags               | (behind 154)  | (ahead 23) | origin/master |
  | fuzzer asan_option         | (behind 1581) | (ahead 15) | origin/master |
  | fuzzer experiments         | (behind 3348) | (ahead 12) | origin/master |
  | fuzzer weighted_rnd        | (behind 2819) | (ahead 1)  | origin/master |
  | libfuzzer arbitrary_fun    | (behind 626)  | (ahead 1)  | origin/master |
  | libfuzzer buildgn          | (behind 806)  | (ahead 1)  | origin/master |
  | libfuzzer custom_mutator   | (behind 382)  | (ahead 1)  | origin/master |
  | master                     | (behind 378)  | (even)     | origin/master |
  | reading fix                | (behind 235)  | (even)     | origin/master |
  | sancov cfg                 | (behind 1377) | (ahead 1)  | origin/master |
  | sancov dominators          | (behind 3)    | (ahead 1)  | origin/master |
  | sancov frontier            | (behind 806)  | (ahead 1)  | origin/master |
  | sancov function_pct        | (behind 176)  | (ahead 5)  | origin/master |
  | sancov module_style        | (behind 80)   | (even)     | origin/master |
  | sancov stats               | (even)        | (ahead 1)  | origin/master |
  | santizer coverage_pass_dep | (behind 154)  | (ahead 1)  | origin/master |
  | stl extra                  | (behind 176)  | (ahead 2)  | origin/master |
  ---------------------------------------------------------------------------

  local <-> origin
  ------------------------------
  | Everything is synchronized |
  ------------------------------

@bill-auger
Copy link
Author

bill-auger commented May 27, 2016

@mikea - sry i did not see this earlier - unfortunately github does not notify anyone of comments to gists so i only see them by looking at this web page explicitly - i have been planning to move this script to github and give it a GPL so that it can have an issue tracker and be properly shared - the original author and contributors have agreed this was a good idea but i have not gotten around to it yet - i will post here when it happens

to answer your question - no it was not intentional - i use dashes instead of underscores so i did not notice - almost certainly can be fixed - i will look into it

@bill-auger
Copy link
Author

bill-auger commented May 27, 2016

i have created a proper repo for this script on github - please direct future comments to the issue tracker there https://github.com/bill-auger/git-branch-status/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment