|
1 | 1 | alias.*:: |
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. |
| 2 | +alias.*.command:: |
| 3 | + Command aliases for the linkgit:git[1] command wrapper. Aliases |
| 4 | + can be defined using two syntaxes: |
| 5 | ++ |
| 6 | +-- |
| 7 | +1. Without a subsection, e.g., `[alias] co = checkout`. The alias |
| 8 | + name ("co" in this example) is |
| 9 | + limited to ASCII alphanumeric characters and `-`, |
| 10 | + and is matched case-insensitively. |
| 11 | +2. With a subsection, e.g., `[alias "co"] command = checkout`. The |
| 12 | + alias name can contain any characters (except for newlines and NUL bytes), |
| 13 | + including UTF-8, and is matched case-sensitively as raw bytes. |
| 14 | + You define the action of the alias in the `command`. |
| 15 | +-- |
| 16 | ++ |
| 17 | +Examples: |
| 18 | ++ |
| 19 | +---- |
| 20 | +# Without subsection (ASCII alphanumeric and dash only) |
| 21 | +[alias] |
| 22 | + co = checkout |
| 23 | + st = status |
| 24 | + |
| 25 | +# With subsection (allows any characters, including UTF-8) |
| 26 | +[alias "hämta"] |
| 27 | + command = fetch |
| 28 | +[alias "rätta till"] |
| 29 | + command = commit --amend |
| 30 | +---- |
| 31 | ++ |
| 32 | +With a Git alias defined, e.g., |
| 33 | + |
| 34 | + $ git config --global alias.last "cat-file commit HEAD" |
| 35 | + # Which is equivalent to |
| 36 | + $ git config --global alias.last.command "cat-file commit HEAD" |
| 37 | + |
| 38 | +`git last` is equivalent to `git cat-file commit HEAD`. To avoid |
| 39 | +confusion and troubles with script usage, aliases that |
| 40 | +hide existing Git commands are ignored except for deprecated |
| 41 | +commands. Arguments are split by |
| 42 | +spaces, the usual shell quoting and escaping are supported. |
| 43 | +A quote pair or a backslash can be used to quote them. |
10 | 44 | + |
11 | 45 | Note that the first word of an alias does not necessarily have to be a |
12 | 46 | command. It can be a command-line option that will be passed into the |
|
0 commit comments