Skip to content

Commit c0e3d26

Browse files
committed
add CLI switch for showing all local branches
1 parent e787911 commit c0e3d26

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ USAGE:
4141
git-branch-status [ -b | --branch ] [filter-branch-name]
4242
git-branch-status [ -d | --dates ]
4343
git-branch-status [ -h | --help ]
44+
git-branch-status [ -l | --local ]
4445
git-branch-status [ -r | --remotes ]
4546
git-branch-status [ -v | --verbose ]
4647
@@ -59,7 +60,7 @@ EXAMPLES:
5960
$ git-branch-status fork/arbitrary-branch local-arbitrary-branch
6061
| fork/arbitrary-branch | (behind 1) | (even) | local-arbitrary-branch |
6162
62-
# show all branches - including those synchronized, with no upstream, or not checked-out
63+
# show all branches - including those synchronized, non-tracking, or not checked-out
6364
$ git-branch-status -a
6465
$ git-branch-status --all
6566
| master | (even) | (ahead 1) | origin/master |
@@ -90,6 +91,13 @@ EXAMPLES:
9091
$ git-branch-status --help
9192
"prints this usage message"
9293
94+
# show all local branches - including those synchronized or non-tracking
95+
$ git-branch-status -l
96+
$ git-branch-status --local
97+
| master | (even) | (ahead 1) | origin/master |
98+
| tracked-branch | (even) | (even) | origin/tracked-branch |
99+
| local-branch | n/a | n/a | (no upstream) |
100+
93101
# show all remote branches - including those not checked-out
94102
$ git-branch-status -r
95103
$ git-branch-status --remotes

git-branch-status

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
# along with git-branch-status. If not, see <http://www.gnu.org/licenses/>.
2121

2222
# credits:
23-
# * original `git rev-list` grepping by Jehiah Czebotar
24-
# * "s'all good!" message by Fredrik Strandin
25-
# * ANSI colors by Kristijan Novoselić
26-
# * formatting, filters, switches,
27-
# usage, dates, remotes, and arbitrary branches by bill-auger
23+
# * original `git rev-list` grepping - by Jehiah Czebotar
24+
# * "s'all good!" message - by Fredrik Strandin
25+
# * ANSI colors - by Kristijan Novoselić
26+
# * various features and maintenance - by bill-auger
2827

2928
# please direct comments, bug reports, feature requests, or PRs to one of the upstream repos:
3029
# * https://github.com/bill-auger/git-branch-status/issues/
@@ -40,6 +39,7 @@ USAGE:
4039
git-branch-status [ -b | --branch ] [filter-branch-name]
4140
git-branch-status [ -d | --dates ]
4241
git-branch-status [ -h | --help ]
42+
git-branch-status [ -l | --local ]
4343
git-branch-status [ -r | --remotes ]
4444
git-branch-status [ -v | --verbose ]
4545
@@ -58,7 +58,7 @@ EXAMPLES:
5858
$ git-branch-status fork/arbitrary-branch local-arbitrary-branch
5959
| fork/arbitrary-branch | (behind 1) | (even) | local-arbitrary-branch |
6060
61-
# show all branches - including those up-to-date, with no upstream, or not checked-out
61+
# show all branches - including those synchronized, non-tracking, or not checked-out
6262
$ git-branch-status -a
6363
$ git-branch-status --all
6464
| master | (even) | (ahead 1) | origin/master |
@@ -89,6 +89,13 @@ EXAMPLES:
8989
$ git-branch-status --help
9090
"prints this usage message"
9191
92+
# show all local branches - including those synchronized or non-tracking
93+
$ git-branch-status -l
94+
$ git-branch-status --local
95+
| master | (even) | (ahead 1) | origin/master |
96+
| tracked-branch | (even) | (even) | origin/tracked-branch |
97+
| local-branch | n/a | n/a | (no upstream) |
98+
9299
# show all remote branches - including those not checked-out
93100
$ git-branch-status -r
94101
$ git-branch-status --remotes
@@ -415,6 +422,7 @@ case "$1" in
415422
'-b'|'--branch' ) [ "$2" ] && branch_a="$2" || branch_a=$(GetCurrentBranch) ;;
416423
'-d'|'--dates' ) show_dates=1 ;;
417424
'-h'|'--help' ) echo "$USAGE" ; exit ;;
425+
'-l'|'--local' ) show_all_local=1 ; show_all_upstream=1 ; ;;
418426
'-r'|'--remotes' ) show_all_remote=1 ;;
419427
'-v'|'--verbose' ) show_all=1 ; show_dates=1 ;;
420428
* ) branch_a="$1" branch_b="$2" ;;

0 commit comments

Comments
 (0)