1git-check-ref-format(1)
2=======================
34
NAME
5----
6git-check-ref-format - Ensures that a reference name is well formed
78
SYNOPSIS
9--------
10[verse]
11'git check-ref-format' <refname>
12'git check-ref-format' [--branch] <branchname-shorthand>
1314
DESCRIPTION
15-----------
16Checks if a given 'refname' is acceptable, and exits with a non-zero
17status if it is not.
1819
A reference is used in git to specify branches and tags. A
20branch head is stored under the `$GIT_DIR/refs/heads` directory, and
21a tag is stored under the `$GIT_DIR/refs/tags` directory. git
22imposes the following rules on how references are named:
2324
. They can include slash `/` for hierarchical (directory)
25grouping, but no slash-separated component can begin with a
26dot `.`.
2728
. They cannot have two consecutive dots `..` anywhere.
2930
. They cannot have ASCII control characters (i.e. bytes whose
31values are lower than \040, or \177 `DEL`), space, tilde `~`,
32caret `{caret}`, colon `:`, question-mark `?`, asterisk `*`,
33or open bracket `[` anywhere.
3435
. They cannot end with a slash `/` nor a dot `.`.
3637
. They cannot end with the sequence `.lock`.
3839
. They cannot contain a sequence `@{`.
4041
These rules make it easy for shell script based tools to parse
42reference names, pathname expansion by the shell when a reference name is used
43unquoted (by mistake), and also avoids ambiguities in certain
44reference name expressions (see linkgit:git-rev-parse[1]):
4546
. A double-dot `..` is often used as in `ref1..ref2`, and in some
47contexts this notation means `{caret}ref1 ref2` (i.e. not in
48`ref1` and in `ref2`).
4950
. A tilde `~` and caret `{caret}` are used to introduce the postfix
51'nth parent' and 'peel onion' operation.
5253
. A colon `:` is used as in `srcref:dstref` to mean "use srcref\'s
54value and store it in dstref" in fetch and push operations.
55It may also be used to select a specific object such as with
56'git-cat-file': "git cat-file blob v1.3.3:refs.c".
5758
. at-open-brace `@{` is used as a notation to access a reflog entry.
5960
With the `--branch` option, it expands a branch name shorthand and
61prints the name of the branch the shorthand refers to.
6263
EXAMPLE
64-------
6566
git check-ref-format --branch @{-1}::
6768
Print the name of the previous branch.
6970
71
GIT
72---
73Part of the linkgit:git[1] suite