@@ -12,7 +12,7 @@ ${b}NAME${r}
12
12
${u} git-context-graph${r} - Show graph log of branch, its remote counterparts and default branch.
13
13
14
14
${b} SYNOPSIS${r}
15
- ${u} git${r} ${u} context-graph${r} [--no-default] [-a|--add] [<branch>...]
15
+ ${u} git${r} ${u} context-graph${r} [--local] [-- no-default] [-a|--add] [<branch>...]
16
16
${u} git${r} ${u} context-graph${r} [<git-log options>...] [<options>...] [<branch>...] [-- <paths>...]
17
17
18
18
${u} git${r} ${u} context-graph${r} (-l|--list) [-s|--short] [<branch>...]
@@ -28,7 +28,7 @@ ${b}DESCRIPTION${r}
28
28
git log --color --graph --abbrev-commit --decorate --pretty=oneline \\
29
29
my-branch origin/my-branch main origin/main ...
30
30
31
- ${u} git${r} ${u} context-graph${r} [--no-default] [-a|--add] [<branch>...]
31
+ ${u} git${r} ${u} context-graph${r} [--local] [-- no-default] [-a|--add] [<branch>...]
32
32
Show graph log of branch, its remote counterparts and default branch.
33
33
34
34
${u} git${r} ${u} context-graph${r} [<git-log options>...] [<options>...] [<branch>...] [-- <paths>...]
@@ -55,6 +55,9 @@ ${b}OPTIONS${r}
55
55
-a|--add
56
56
Consider <branch> arguments as additional branches (added to current branch).
57
57
58
+ --local
59
+ Show only local branches (ignore remotes).
60
+
58
61
--no-default
59
62
Show only related branches (local and remote), without default branch ('main' / 'master').
60
63
@@ -99,11 +102,18 @@ branch_with_remotes() {
99
102
return
100
103
fi
101
104
105
+ local ref_pattern
106
+ [[ -z $GIT_CG_SHOW_LOCAL_ONLY ]] &&
107
+ ref_pattern=" refs/**/$short_branch " ||
108
+ ref_pattern=" refs/heads/$short_branch "
109
+
102
110
# Branches with same name on all remotes
103
111
local same_name_refs;
104
- same_name_refs=$( git for-each-ref --format=" %(refname)" " refs/**/ $short_branch " )
112
+ same_name_refs=$( git for-each-ref --format=" %(refname)" " $ref_pattern " )
105
113
echo " $same_name_refs "
106
114
115
+ [[ -n $GIT_CG_SHOW_LOCAL_ONLY ]] && return
116
+
107
117
# Remote tracking branch (in case name is different)
108
118
local tracking_remote;
109
119
tracking_remote=$( git for-each-ref --format=' %(upstream)' " $( git rev-parse --symbolic-full-name " $branch " 2> /dev/null) " )
@@ -304,6 +314,7 @@ while [[ $# -gt 0 ]]; do
304
314
case $1 in
305
315
-a|--add) GIT_CG_ADD_TO_CURRENT=1; shift ;;
306
316
317
+ --local) GIT_CG_SHOW_LOCAL_ONLY=1; shift ;;
307
318
--no-default) GIT_CG_SHOW_RELATED_ONLY=1; shift ;;
308
319
309
320
-l|--list) GIT_CG_LIST=1; shift ;;
0 commit comments