Skip to content

Commit 084ae0a

Browse files
dschoJunio C Hamano
authored andcommitted
reflog inspection: introduce shortcut "-g"
A short-hand "-g" for "git log --walk-reflogs" and "git show-branch --reflog" makes it easier to access the reflog info. [jc: added -g to show-branch for symmetry] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent e955ae9 commit 084ae0a

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

Documentation/git-rev-list.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ limiting may be applied.
191191
In addition to the '<commit>' listed on the command
192192
line, read them from the standard input.
193193

194-
--walk-reflogs::
194+
-g, --walk-reflogs::
195195

196196
Instead of walking the commit ancestry chain, walk
197197
reflog entries from the most recent one to older ones.

Documentation/git-show-branch.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SYNOPSIS
1111
'git-show-branch' [--all] [--remotes] [--topo-order] [--current]
1212
[--more=<n> | --list | --independent | --merge-base]
1313
[--no-name | --sha1-name] [--topics] [<rev> | <glob>]...
14-
'git-show-branch' --reflog[=<n>[,<base>]] [--list] <ref>
14+
'git-show-branch' (-g|--reflog)[=<n>[,<base>]] [--list] <ref>
1515

1616
DESCRIPTION
1717
-----------
@@ -100,8 +100,8 @@ OPTIONS
100100
--reflog[=<n>[,<base>]] <ref>::
101101
Shows <n> most recent ref-log entries for the given
102102
ref. If <base> is given, <n> entries going back from
103-
that entry. <base> can be specified as count or date
104-
103+
that entry. <base> can be specified as count or date.
104+
`-g` can be used as a short-hand for this option.
105105

106106
Note that --more, --list, --independent and --merge-base options
107107
are mutually exclusive.

builtin-show-branch.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,13 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
649649
dense = 0;
650650
else if (!strcmp(arg, "--date-order"))
651651
lifo = 0;
652-
else if (!strcmp(arg, "--reflog")) {
652+
else if (!strcmp(arg, "--reflog") || !strcmp(arg, "-g")) {
653653
reflog = DEFAULT_REFLOG;
654654
}
655655
else if (!strncmp(arg, "--reflog=", 9))
656656
parse_reflog_param(arg + 9, &reflog, &reflog_base);
657+
else if (!strncmp(arg, "-g=", 3))
658+
parse_reflog_param(arg + 3, &reflog, &reflog_base);
657659
else
658660
usage(show_branch_usage);
659661
ac--; av++;

revision.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
868868
handle_reflog(revs, flags);
869869
continue;
870870
}
871-
if (!strcmp(arg, "--walk-reflogs")) {
871+
if (!strcmp(arg, "-g") ||
872+
!strcmp(arg, "--walk-reflogs")) {
872873
init_reflog_walk(&revs->reflog_info);
873874
continue;
874875
}

0 commit comments

Comments
 (0)