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