c707fbcf99dd385112f910c235738dac42bd679d
[git.git] / Documentation / git-config-set.txt
1 git-config-set(1)
2 ===============
3
4 NAME
5 ----
6 git-config-set - Set options in .git/config.
7
8
9 SYNOPSIS
10 --------
11 'git-config-set' name [value [value_regex]]
12 'git-config-set' --replace-all name [value [value_regex]]
13 'git-config-set' --get name [value_regex]
14 'git-config-set' --get-all name [value_regex]
15 'git-config-set' --unset name [value_regex]
16 'git-config-set' --unset-all name [value_regex]
17
18 DESCRIPTION
19 -----------
20 You can query/set/replace/unset options with this command. The name is
21 actually the section and the key separated by a dot, and the value will be
22 escaped.
23
24 If you want to set/unset an option which can occor on multiple lines, you
25 should provide a POSIX regex for the value.
26
27 This command will fail if
28
29 . .git/config is invalid,
30 . .git/config can not be written to,
31 . no section was provided,
32 . the section or key is invalid,
33 . you try to unset an option which does not exist, or
34 . you try to unset/set an option for which multiple lines match.
35
36
37 OPTIONS
38 -------
39
40 --replace-all::
41         Default behaviour is to replace at most one line. This replaces
42         all lines matching the key (and optionally the value_regex)
43
44 --get::
45         Get the value for a given key (optionally filtered by a regex
46         matching the value).
47
48 --get-all::
49         Like get, but does not fail if the number of values for the key
50         is not exactly one.
51
52 --unset::
53         Remove the line matching the key from .git/config.
54
55 --unset-all::
56         Remove all matching lines from .git/config.
57
58
59 EXAMPLE
60 -------
61
62 Given a .git/config like this:
63
64         #
65         # This is the config file, and
66         # a '#' or ';' character indicates
67         # a comment
68         #
69
70         ; core variables
71         [core]
72                 ; Don't trust file modes
73                 filemode = false
74
75         ; Our diff algorithm
76         [diff]
77                 external = "/usr/local/bin/gnu-diff -u"
78                 renames = true
79
80         ; Proxy settings
81         [proxy]
82                 command="ssh" for "ssh://kernel.org/"
83                 command="proxy-command" for kernel.org
84                 command="myprotocol-command" for "my://"
85
86 you can set the filemode to true with
87
88 ------------
89 % git config-set core.filemode true
90 ------------
91
92 The hypothetic proxy command entries actually have a postfix to discern
93 to what URL they apply. Here is how to change the entry for kernel.org
94 to "ssh".
95
96 ------------
97 % git config-set proxy.command '"ssh" for kernel.org' 'for kernel.org$'
98 ------------
99
100 This makes sure that only the key/value pair for kernel.org is replaced.
101
102 To delete the entry for renames, do
103
104 ------------
105 % git config-set --unset diff.renames
106 ------------
107
108 If you want to delete an entry for a multivar (like proxy.command above),
109 you have to provide a regex matching the value of exactly one line.
110
111 To query the value for a given key, do
112
113 ------------
114 % git config-set --get core.filemode
115 ------------
116
117 or
118
119 ------------
120 % git config-set core.filemode
121 ------------
122
123 or, to query a multivar:
124
125 ------------
126 % git config-set --get proxy.command "for kernel.org$"
127 ------------
128
129 If you want to know all the values for a multivar, do:
130
131 ------------
132 % git config-set --get-all proxy.command
133 ------------
134
135 If you like to live dangerous, you can replace *all* proxy.commands by a
136 new one with
137
138 ------------
139 % git config-set --replace-all proxy.command ssh
140 ------------
141
142
143 Author
144 ------
145 Written by Johannes Schindelin <Johannes.Schindelin@gmx.de>
146
147 Documentation
148 --------------
149 Documentation by Johannes Schindelin.
150
151 GIT
152 ---
153 Part of the gitlink:git[7] suite
154