git
[Ported from github.com/git/git] Sync with Git 2.56.1
Brought by drakestapleton
git / Documentation / git-var.adoc
| 1 | git-var(1) |
| 2 | ========== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
| 6 | git-var - Show a Git logical variable |
| 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
| 11 | [synopsis] |
| 12 | git var [-z] -l |
| 13 | git var [-z] <variable>... |
| 14 | |
| 15 | DESCRIPTION |
| 16 | ----------- |
| 17 | Prints Git logical variables. When a single variable is requested, its |
| 18 | bare value is printed, and the command exits with code 1 if it has no |
| 19 | value. When multiple variables are requested, they are printed as |
| 20 | `VARIABLE=value` pairs, separated by newlines; a variable that has no |
| 21 | value is omitted from the output, which is not by itself an error. |
| 22 | |
| 23 | If `-z` is given, the output format changes depending on the mode: |
| 24 | |
| 25 | * With a single variable, the bare value is terminated by a NUL byte. |
| 26 | * With multiple variables or with `-l`, the variable name and value are |
| 27 | separated by a newline, and each entry is terminated by a NUL byte |
| 28 | (`VARIABLE\nvalue\0`), in the same way as `git config list -z`. |
| 29 | |
| 30 | OPTIONS |
| 31 | ------- |
| 32 | `-l`:: |
| 33 | Display the logical variables. In addition, all the |
| 34 | variables of the Git configuration file .git/config are listed |
| 35 | as well. (However, the configuration variables listing functionality |
| 36 | is deprecated in favor of `git config list`.) |
| 37 | |
| 38 | `-z`:: |
| 39 | Terminate entries with NUL instead of newline. When used with |
| 40 | `-l` or when multiple variables are requested, the variable name |
| 41 | and its value are separated by a newline, and each entry is |
| 42 | terminated with a NUL byte. |
| 43 | |
| 44 | EXAMPLES |
| 45 | -------- |
| 46 | * Get the author identity: |
| 47 | + |
| 48 | ------------ |
| 49 | $ git var GIT_AUTHOR_IDENT |
| 50 | Eric W. Biederman <ebiederm@lnxi.com> 1121223278 -0600 |
| 51 | ------------ |
| 52 | |
| 53 | * Get the author name and email: |
| 54 | + |
| 55 | ------------ |
| 56 | $ git var GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL |
| 57 | GIT_AUTHOR_NAME=Eric W. Biederman |
| 58 | GIT_AUTHOR_EMAIL=ebiederm@lnxi.com |
| 59 | ------------ |
| 60 | |
| 61 | |
| 62 | VARIABLES |
| 63 | --------- |
| 64 | `GIT_AUTHOR_IDENT`:: |
| 65 | `GIT_AUTHOR_NAME`:: |
| 66 | `GIT_AUTHOR_EMAIL`:: |
| 67 | `GIT_AUTHOR_DATE`:: |
| 68 | The authorship information that would be recorded in the |
| 69 | resulting commit object if you ran `git commit` right now. |
| 70 | `GIT_AUTHOR_IDENT` consists of the author's name, e-mail |
| 71 | address, and timestamp+timezone. These three pieces of |
| 72 | information are available separately as `GIT_AUTHOR_NAME`, |
| 73 | `GIT_AUTHOR_EMAIL`, and `GIT_AUTHOR_DATE`. |
| 74 | |
| 75 | `GIT_COMMITTER_IDENT`:: |
| 76 | `GIT_COMMITTER_NAME`:: |
| 77 | `GIT_COMMITTER_EMAIL`:: |
| 78 | `GIT_COMMITTER_DATE`:: |
| 79 | The committer information that would be recorded in the |
| 80 | resulting commit object if you ran `git commit` right now. |
| 81 | `GIT_COMMITTER_IDENT` consists of the committer's name, e-mail |
| 82 | address, and timestamp+timezone. These three pieces of |
| 83 | information are available separately as `GIT_COMMITTER_NAME`, |
| 84 | `GIT_COMMITTER_EMAIL`, and `GIT_COMMITTER_DATE`. |
| 85 | |
| 86 | `GIT_EDITOR`:: |
| 87 | Text editor for use by Git commands. The value is meant to be |
| 88 | interpreted by the shell when it is used. Examples: `~/bin/vi`, |
| 89 | `$SOME_ENVIRONMENT_VARIABLE`, `"C:\Program Files\Vim\gvim.exe" |
| 90 | --nofork`. The order of preference is `$GIT_EDITOR`, then |
| 91 | `core.editor` configuration value, then `$VISUAL`, then |
| 92 | `$EDITOR`, and then the default chosen at compile |
| 93 | time, which is usually 'vi'. |
| 94 | ifdef::git-default-editor[] |
| 95 | The build you are using chose '{git-default-editor}' as the default. |
| 96 | endif::git-default-editor[] |
| 97 | |
| 98 | `GIT_SEQUENCE_EDITOR`:: |
| 99 | Text editor used to edit the 'todo' file while running `git rebase |
| 100 | -i`. Like `GIT_EDITOR`, the value is meant to be interpreted by |
| 101 | the shell when it is used. The order of preference is |
| 102 | `$GIT_SEQUENCE_EDITOR`, then `sequence.editor` configuration value, |
| 103 | and then the value of `git var GIT_EDITOR`. |
| 104 | |
| 105 | `GIT_PAGER`:: |
| 106 | Text viewer for use by Git commands (e.g., 'less'). The value |
| 107 | is meant to be interpreted by the shell. The order of preference |
| 108 | is `$GIT_PAGER`, then the value of `core.pager` configuration, then |
| 109 | `$PAGER`, and then the default chosen at compile time (usually `less`). |
| 110 | ifdef::git-default-pager[] |
| 111 | The build you are using chose '{git-default-pager}' as the default. |
| 112 | endif::git-default-pager[] |
| 113 | |
| 114 | `GIT_DEFAULT_BRANCH`:: |
| 115 | The name of the first branch created in newly initialized repositories. |
| 116 | |
| 117 | `GIT_SHELL_PATH`:: |
| 118 | The path of the binary providing the POSIX shell for commands which use the shell. |
| 119 | |
| 120 | `GIT_ATTR_SYSTEM`:: |
| 121 | The path to the system linkgit:gitattributes[5] file, if one is enabled. |
| 122 | |
| 123 | `GIT_ATTR_GLOBAL`:: |
| 124 | The path to the global (per-user) linkgit:gitattributes[5] file. |
| 125 | |
| 126 | `GIT_CONFIG_SYSTEM`:: |
| 127 | The path to the system configuration file, if one is enabled. |
| 128 | |
| 129 | `GIT_CONFIG_GLOBAL`:: |
| 130 | The path to the global (per-user) configuration files, if any. |
| 131 | This variable can have multiple values. |
| 132 | |
| 133 | `GIT_HOSTNAME`:: |
| 134 | The hostname of the machine, as reported by the operating system. |
| 135 | This is the hostname matched by `includeIf "hostname:..."` (see |
| 136 | linkgit:git-config[1]). |
| 137 | |
| 138 | Most path values contain only one value. However, some can contain multiple |
| 139 | values, which are separated by newlines (or NUL bytes if `-z` is given), |
| 140 | and are listed in order from highest to lowest priority. When querying |
| 141 | multiple variables (or using `-l`), each value is output as a separate |
| 142 | `VARIABLE=value` entry (or `VARIABLE\nvalue\0` with `-z`). Callers should |
| 143 | be prepared for any such path value to contain multiple items. |
| 144 | |
| 145 | Note that paths are printed even if they do not exist, but not if they are |
| 146 | disabled by other environment variables. |
| 147 | |
| 148 | SEE ALSO |
| 149 | -------- |
| 150 | linkgit:git-commit-tree[1] |
| 151 | linkgit:git-tag[1] |
| 152 | linkgit:git-config[1] |
| 153 | |
| 154 | GIT |
| 155 | --- |
| 156 | Part of the linkgit:git[1] suite |