1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
\r
4 <article lang="en" id="git-check-ref-format(1)">
\r
6 <title>git-check-ref-format(1)</title>
\r
8 <primary>git-check-ref-format(1)</primary>
\r
11 <simplesect id="_name">
\r
13 <simpara>git-check-ref-format - Make sure ref name is well formed</simpara>
\r
15 <simplesect id="_synopsis">
\r
16 <title>SYNOPSIS</title>
\r
17 <simpara><emphasis>git check-ref-format</emphasis> <refname></simpara>
\r
19 <simplesect id="_description">
\r
20 <title>DESCRIPTION</title>
\r
21 <simpara>Checks if a given <emphasis>refname</emphasis> is acceptable, and exits non-zero if
\r
22 it is not.</simpara>
\r
23 <simpara>A reference is used in git to specify branches and tags. A
\r
24 branch head is stored under <literal>$GIT_DIR/refs/heads</literal> directory, and
\r
25 a tag is stored under <literal>$GIT_DIR/refs/tags</literal> directory. git
\r
26 imposes the following rules on how refs are named:</simpara>
\r
27 <orderedlist numeration="arabic">
\r
30 It can include slash <literal>/</literal> for hierarchical (directory)
\r
31 grouping, but no slash-separated component can begin with a
\r
32 dot <literal>.</literal>;
\r
37 It cannot have two consecutive dots <literal>..</literal> anywhere;
\r
42 It cannot have ASCII control character (i.e. bytes whose
\r
43 values are lower than \040, or \177 <literal>DEL</literal>), space, tilde <literal>~</literal>,
\r
44 caret <literal>^</literal>, colon <literal>:</literal>, question-mark <literal>?</literal>, asterisk <literal>*</literal>,
\r
45 or open bracket <literal>[</literal> anywhere;
\r
50 It cannot end with a slash <literal>/</literal>.
\r
54 <simpara>These rules makes it easy for shell script based tools to parse
\r
55 refnames, pathname expansion by the shell when a refname is used
\r
56 unquoted (by mistake), and also avoids ambiguities in certain
\r
57 refname expressions (see <xref linkend="git-rev-parse(1)"/>). Namely:</simpara>
\r
58 <orderedlist numeration="arabic">
\r
61 double-dot <literal>..</literal> are often used as in <literal>ref1..ref2</literal>, and in some
\r
62 context this notation means <literal>^ref1 ref2</literal> (i.e. not in
\r
68 tilde <literal>~</literal> and caret <literal>^</literal> are used to introduce postfix
\r
69 <emphasis>nth parent</emphasis> and <emphasis>peel onion</emphasis> operation.
\r
74 colon <literal>:</literal> is used as in <literal>srcref:dstref</literal> to mean "use srcref’s
\r
75 value and store it in dstref" in fetch and push operations.
\r
76 It may also be used to select a specific object such as with
\r
77 <emphasis>git-cat-file</emphasis>: "git cat-file blob v1.3.3:refs.c".
\r
82 <simplesect id="_git">
\r
84 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
\r