aboutsummaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-02-27 15:11:53 -0800
committerJunio C Hamano <gitster@pobox.com>2026-02-27 15:11:53 -0800
commitc0d0b8daedd336677ed30bfb6bb7cdc6c47a468a (patch)
tree0a35c3e3b9065c7bd1714f56a4eb624ad4c185b8 /Documentation
parentac78c5804e080aa8f0307155eda85465a2a1b1dd (diff)
parentedd8ad18a643d47dd92b08ab865bf7f4a26f50bc (diff)
downloadgit-c0d0b8daedd336677ed30bfb6bb7cdc6c47a468a.tar.xz
Merge branch 'jh/alias-i18n'
Extend the alias configuration syntax to allow aliases using characters outside ASCII alphanumeric (plus '-'). * jh/alias-i18n: completion: fix zsh alias listing for subsection aliases alias: support non-alphanumeric names via subsection syntax alias: prepare for subsection aliases help: use list_aliases() for alias listing
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/config/alias.adoc50
1 files changed, 42 insertions, 8 deletions
diff --git a/Documentation/config/alias.adoc b/Documentation/config/alias.adoc
index 80ce17d2de..115fdbb1e3 100644
--- a/Documentation/config/alias.adoc
+++ b/Documentation/config/alias.adoc
@@ -1,12 +1,46 @@
alias.*::
- Command aliases for the linkgit:git[1] command wrapper - e.g.
- after defining `alias.last = cat-file commit HEAD`, the invocation
- `git last` is equivalent to `git cat-file commit HEAD`. To avoid
- confusion and troubles with script usage, aliases that
- hide existing Git commands are ignored except for deprecated
- commands. Arguments are split by
- spaces, the usual shell quoting and escaping are supported.
- A quote pair or a backslash can be used to quote them.
+alias.*.command::
+ Command aliases for the linkgit:git[1] command wrapper. Aliases
+ can be defined using two syntaxes:
++
+--
+1. Without a subsection, e.g., `[alias] co = checkout`. The alias
+ name ("co" in this example) is
+ limited to ASCII alphanumeric characters and `-`,
+ and is matched case-insensitively.
+2. With a subsection, e.g., `[alias "co"] command = checkout`. The
+ alias name can contain any characters (except for newlines and NUL bytes),
+ including UTF-8, and is matched case-sensitively as raw bytes.
+ You define the action of the alias in the `command`.
+--
++
+Examples:
++
+----
+# Without subsection (ASCII alphanumeric and dash only)
+[alias]
+ co = checkout
+ st = status
+
+# With subsection (allows any characters, including UTF-8)
+[alias "hämta"]
+ command = fetch
+[alias "rätta till"]
+ command = commit --amend
+----
++
+With a Git alias defined, e.g.,
+
+ $ git config --global alias.last "cat-file commit HEAD"
+ # Which is equivalent to
+ $ git config --global alias.last.command "cat-file commit HEAD"
+
+`git last` is equivalent to `git cat-file commit HEAD`. To avoid
+confusion and troubles with script usage, aliases that
+hide existing Git commands are ignored except for deprecated
+commands. Arguments are split by
+spaces, the usual shell quoting and escaping are supported.
+A quote pair or a backslash can be used to quote them.
+
Note that the first word of an alias does not necessarily have to be a
command. It can be a command-line option that will be passed into the