Skip to content

Commit 747201d

Browse files
committed
Merge branch 'dl/config-alias-doc' into maint
Doc update. * dl/config-alias-doc: config/alias.txt: document alias accepting non-command first word config/alias.txt: change " and ' to `
2 parents ea21965 + 459842e commit 747201d

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

Documentation/config/alias.txt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
alias.*::
22
Command aliases for the linkgit:git[1] command wrapper - e.g.
3-
after defining "alias.last = cat-file commit HEAD", the invocation
4-
"git last" is equivalent to "git cat-file commit HEAD". To avoid
3+
after defining `alias.last = cat-file commit HEAD`, the invocation
4+
`git last` is equivalent to `git cat-file commit HEAD`. To avoid
55
confusion and troubles with script usage, aliases that
66
hide existing Git commands are ignored. Arguments are split by
77
spaces, the usual shell quoting and escaping is supported.
88
A quote pair or a backslash can be used to quote them.
99
+
10+
Note that the first word of an alias does not necessarily have to be a
11+
command. It can be a command-line option that will be passed into the
12+
invocation of `git`. In particular, this is useful when used with `-c`
13+
to pass in one-time configurations or `-p` to force pagination. For example,
14+
`loud-rebase = -c commit.verbose=true rebase` can be defined such that
15+
running `git loud-rebase` would be equivalent to
16+
`git -c commit.verbose=true rebase`. Also, `ps = -p status` would be a
17+
helpful alias since `git ps` would paginate the output of `git status`
18+
where the original command does not.
19+
+
1020
If the alias expansion is prefixed with an exclamation point,
1121
it will be treated as a shell command. For example, defining
12-
"alias.new = !gitk --all --not ORIG_HEAD", the invocation
13-
"git new" is equivalent to running the shell command
14-
"gitk --all --not ORIG_HEAD". Note that shell commands will be
22+
`alias.new = !gitk --all --not ORIG_HEAD`, the invocation
23+
`git new` is equivalent to running the shell command
24+
`gitk --all --not ORIG_HEAD`. Note that shell commands will be
1525
executed from the top-level directory of a repository, which may
1626
not necessarily be the current directory.
17-
`GIT_PREFIX` is set as returned by running 'git rev-parse --show-prefix'
27+
`GIT_PREFIX` is set as returned by running `git rev-parse --show-prefix`
1828
from the original current directory. See linkgit:git-rev-parse[1].

0 commit comments

Comments
 (0)