Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Git-branches – list of branches with behind/ahead counts
5 points by dmitshur on June 13, 2015 | hide | past | favorite
git-branches is a go gettable command that displays branches with behind/ahead commit counts.

If you've ever used GitHub, you'll notice their branches page displays this info. This is that, but for your local git repo, in the terminal.

Go to any git repo you're working on and type:

    $ git branch
      feature/sanitized_anchor_name_context
    * master
      unfinished-attempt/alternative-sort-order
      wip/get-tweet-body
Now, do `go get -u github.com/shurcooL/cmd/git-branches` on any machine with Go installed, and then:

    $ git-branches
    | Branch                                    | Behind | Ahead |
    |-------------------------------------------|-------:|:------|
    | feature/sanitized_anchor_name_context     |    119 | 1     |
    | **master**                                |      0 | 0     |
    | unfinished-attempt/alternative-sort-order |     67 | 1     |
    | wip/get-tweet-body                        |     40 | 1     |
It supports -base option if you want to compare against non-master branch.

It also supports -remote mode, where it compares local branches to their remotes:

    $ git-branches -remote
    | Branch                                    | Remote                                           | Behind | Ahead |
    |-------------------------------------------|--------------------------------------------------|-------:|:------|
    | feature/sanitized_anchor_name_context     | origin/feature/sanitized_anchor_name_context     |      5 | 0     |
    | **master**                                | origin/master                                    |      0 | 1     |
    | unfinished-attempt/alternative-sort-order | origin/unfinished-attempt/alternative-sort-order |      0 | 0     |
    | wip/get-tweet-body                        |                                                  |        |       |
It's easy to see which branches are up to date with remote, which ones need to be pushed/pulled.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: