]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-check-ref-format.txt
Documentation: be consistent about "git-" versus "git "
[thirdparty/git.git] / Documentation / git-check-ref-format.txt
CommitLineData
622ef9df
JH
1git-check-ref-format(1)
2=======================
3
4NAME
5----
7bd7f280 6git-check-ref-format - Make sure ref name is well formed
622ef9df
JH
7
8SYNOPSIS
9--------
b1889c36 10'git check-ref-format' <refname>
622ef9df
JH
11
12DESCRIPTION
13-----------
14Checks if a given 'refname' is acceptable, and exits non-zero if
15it is not.
16
17A reference is used in git to specify branches and tags. A
18branch head is stored under `$GIT_DIR/refs/heads` directory, and
19a tag is stored under `$GIT_DIR/refs/tags` directory. git
20imposes the following rules on how refs are named:
21
37425065
FD
22. It can include slash `/` for hierarchical (directory)
23 grouping, but no slash-separated component can begin with a
24 dot `.`;
622ef9df
JH
25
26. It cannot have two consecutive dots `..` anywhere;
27
28. It cannot have ASCII control character (i.e. bytes whose
29 values are lower than \040, or \177 `DEL`), space, tilde `~`,
68283999
JH
30 caret `{caret}`, colon `:`, question-mark `?`, asterisk `*`,
31 or open bracket `[` anywhere;
622ef9df
JH
32
33. It cannot end with a slash `/`.
34
35These rules makes it easy for shell script based tools to parse
68283999
JH
36refnames, pathname expansion by the shell when a refname is used
37unquoted (by mistake), and also avoids ambiguities in certain
5162e697 38refname expressions (see linkgit:git-rev-parse[1]). Namely:
622ef9df
JH
39
40. double-dot `..` are often used as in `ref1..ref2`, and in some
41 context this notation means `{caret}ref1 ref2` (i.e. not in
42 ref1 and in ref2).
43
44. tilde `~` and caret `{caret}` are used to introduce postfix
45 'nth parent' and 'peel onion' operation.
46
47. colon `:` is used as in `srcref:dstref` to mean "use srcref\'s
48 value and store it in dstref" in fetch and push operations.
87a56cd3 49 It may also be used to select a specific object such as with
b1889c36 50 linkgit:git-cat-file[1] "git cat-file blob v1.3.3:refs.c".
622ef9df
JH
51
52
53GIT
54---
9e1f0a85 55Part of the linkgit:git[1] suite