1 git-check-ref-format(1)
2 =======================
6 git-check-ref-format - Ensures that a reference name is well formed
10 'git check-ref-format' <refname>
14 Checks if a given 'refname' is acceptable, and exits with a non-zero
17 A reference is used in git to specify branches and tags. A
18 branch head is stored under the `$GIT_DIR/refs/heads` directory, and
19 a tag is stored under the `$GIT_DIR/refs/tags` directory. git
20 imposes the following rules on how references are named:
22 . They can include slash `/` for hierarchical (directory)
23 grouping, but no slash-separated component can begin with a
26 . They cannot have two consecutive dots `..` anywhere.
28 . They cannot have ASCII control characters (i.e. bytes whose
29 values are lower than \040, or \177 `DEL`), space, tilde `~`,
30 caret `{caret}`, colon `:`, question-mark `?`, asterisk `*`,
31 or open bracket `[` anywhere.
33 . They cannot end with a slash `/`.
35 These rules make it easy for shell script based tools to parse
36 reference names, pathname expansion by the shell when a reference name is used
37 unquoted (by mistake), and also avoids ambiguities in certain
38 reference name expressions (see linkgit:git-rev-parse[1]):
40 . A double-dot `..` is often used as in `ref1..ref2`, and in some
41 contexts this notation means `{caret}ref1 ref2` (i.e. not in
42 `ref1` and in `ref2`).
44 . A tilde `~` and caret `{caret}` are used to introduce the postfix
45 'nth parent' and 'peel onion' operation.
47 . A colon `:` is used as in `srcref:dstref` to mean "use srcref\'s
48 value and store it in dstref" in fetch and push operations.
49 It may also be used to select a specific object such as with
50 'git-cat-file': "git cat-file blob v1.3.3:refs.c".
55 Part of the linkgit:git[1] suite