blob: 01df96fab3df11f1c804e26ed7c312cd7490e2fd [file] [log] [blame]
Nguyễn Thái Ngọc Duyf740c8f2018-10-27 08:22:38 +02001alias.*::
2 Command aliases for the linkgit:git[1] command wrapper - e.g.
Denton Liu01991ce2019-06-05 16:10:11 -04003 after defining `alias.last = cat-file commit HEAD`, the invocation
4 `git last` is equivalent to `git cat-file commit HEAD`. To avoid
Nguyễn Thái Ngọc Duyf740c8f2018-10-27 08:22:38 +02005 confusion and troubles with script usage, aliases that
6 hide existing Git commands are ignored. Arguments are split by
Elijah Newrence14cc02023-10-08 06:45:09 +00007 spaces, the usual shell quoting and escaping are supported.
Nguyễn Thái Ngọc Duyf740c8f2018-10-27 08:22:38 +02008 A quote pair or a backslash can be used to quote them.
9+
Denton Liu459842e2019-06-05 16:10:13 -040010Note that the first word of an alias does not necessarily have to be a
11command. It can be a command-line option that will be passed into the
12invocation of `git`. In particular, this is useful when used with `-c`
13to 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
15running `git loud-rebase` would be equivalent to
16`git -c commit.verbose=true rebase`. Also, `ps = -p status` would be a
17helpful alias since `git ps` would paginate the output of `git status`
18where the original command does not.
19+
Nguyễn Thái Ngọc Duyf740c8f2018-10-27 08:22:38 +020020If the alias expansion is prefixed with an exclamation point,
21it will be treated as a shell command. For example, defining
Denton Liu01991ce2019-06-05 16:10:11 -040022`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
Nguyễn Thái Ngọc Duyf740c8f2018-10-27 08:22:38 +020025executed from the top-level directory of a repository, which may
26not necessarily be the current directory.
Denton Liu01991ce2019-06-05 16:10:11 -040027`GIT_PREFIX` is set as returned by running `git rev-parse --show-prefix`
Nguyễn Thái Ngọc Duyf740c8f2018-10-27 08:22:38 +020028from the original current directory. See linkgit:git-rev-parse[1].