Git fork
1alias.*::
2 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
5 confusion and troubles with script usage, aliases that
6 hide existing Git commands are ignored except for deprecated
7 commands. Arguments are split by
8 spaces, the usual shell quoting and escaping are supported.
9 A quote pair or a backslash can be used to quote them.
10+
11Note that the first word of an alias does not necessarily have to be a
12command. It can be a command-line option that will be passed into the
13invocation of `git`. In particular, this is useful when used with `-c`
14to pass in one-time configurations or `-p` to force pagination. For example,
15`loud-rebase = -c commit.verbose=true rebase` can be defined such that
16running `git loud-rebase` would be equivalent to
17`git -c commit.verbose=true rebase`. Also, `ps = -p status` would be a
18helpful alias since `git ps` would paginate the output of `git status`
19where the original command does not.
20+
21If the alias expansion is prefixed with an exclamation point,
22it will be treated as a shell command. For example, defining
23`alias.new = !gitk --all --not ORIG_HEAD`, the invocation
24`git new` is equivalent to running the shell command
25`gitk --all --not ORIG_HEAD`. Note:
26+
27* Shell commands will be executed from the top-level directory of a
28 repository, which may not necessarily be the current directory.
29* `GIT_PREFIX` is set as returned by running `git rev-parse --show-prefix`
30 from the original current directory. See linkgit:git-rev-parse[1].
31* Shell command aliases always receive any extra arguments provided to
32 the Git command-line as positional arguments.
33** Care should be taken if your shell alias is a "one-liner" script
34 with multiple commands (e.g. in a pipeline), references multiple
35 arguments, or is otherwise not able to handle positional arguments
36 added at the end. For example: `alias.cmd = "!echo $1 | grep $2"`
37 called as `git cmd 1 2` will be executed as 'echo $1 | grep $2
38 1 2', which is not what you want.
39** A convenient way to deal with this is to write your script
40 operations in an inline function that is then called with any
41 arguments from the command-line. For example `alias.cmd = "!c() {
42 echo $1 | grep $2 ; }; c"` will correctly execute the prior example.
43** Setting `GIT_TRACE=1` can help you debug the command being run for
44 your alias.