Skip to content

Commit 3503b8d

Browse files
committed
Merge branch 'nk/ref-doc' into maint
* nk/ref-doc: glossary: clarify description of HEAD glossary: update description of head and ref glossary: update description of "tag" git.txt: de-emphasize the implementation detail of a ref check-ref-format doc: de-emphasize the implementation detail of a ref git-remote.txt: avoid sounding as if loose refs are the only ones in the world git-remote.txt: fix wrong remote refspec
2 parents 62607e4 + 67393c5 commit 3503b8d

File tree

4 files changed

+34
-30
lines changed

4 files changed

+34
-30
lines changed

Documentation/git-check-ref-format.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ Checks if a given 'refname' is acceptable, and exits with a non-zero
1818
status if it is not.
1919

2020
A reference is used in git to specify branches and tags. A
21-
branch head is stored under the `$GIT_DIR/refs/heads` directory, and
22-
a tag is stored under the `$GIT_DIR/refs/tags` directory (or, if refs
23-
are packed by `git gc`, as entries in the `$GIT_DIR/packed-refs` file).
21+
branch head is stored in the `refs/heads` hierarchy, while
22+
a tag is stored in the `refs/tags` hierarchy of the ref namespace
23+
(typically in `$GIT_DIR/refs/heads` and `$GIT_DIR/refs/tags`
24+
directories or, as entries in file `$GIT_DIR/packed-refs`
25+
if refs are packed by `git gc`).
26+
2427
git imposes the following rules on how references are named:
2528

2629
. They can include slash `/` for hierarchical (directory)

Documentation/git-remote.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ the remote repository.
6060
+
6161
With `-t <branch>` option, instead of the default glob
6262
refspec for the remote to track all branches under
63-
`$GIT_DIR/remotes/<name>/`, a refspec to track only `<branch>`
63+
the `refs/remotes/<name>/` namespace, a refspec to track only `<branch>`
6464
is created. You can give more than one `-t <branch>` to track
6565
multiple branches without grabbing all branches.
6666
+
67-
With `-m <master>` option, `$GIT_DIR/remotes/<name>/HEAD` is set
67+
With `-m <master>` option, a symbolic-ref `refs/remotes/<name>/HEAD` is set
6868
up to point at remote's `<master>` branch. See also the set-head command.
6969
+
7070
When a fetch mirror is created with `\--mirror=fetch`, the refs will not
@@ -92,24 +92,25 @@ configuration settings for the remote are removed.
9292

9393
'set-head'::
9494

95-
Sets or deletes the default branch (`$GIT_DIR/remotes/<name>/HEAD`) for
95+
Sets or deletes the default branch (i.e. the target of the
96+
symbolic-ref `refs/remotes/<name>/HEAD`) for
9697
the named remote. Having a default branch for a remote is not required,
9798
but allows the name of the remote to be specified in lieu of a specific
9899
branch. For example, if the default branch for `origin` is set to
99100
`master`, then `origin` may be specified wherever you would normally
100101
specify `origin/master`.
101102
+
102-
With `-d`, `$GIT_DIR/remotes/<name>/HEAD` is deleted.
103+
With `-d`, the symbolic ref `refs/remotes/<name>/HEAD` is deleted.
103104
+
104-
With `-a`, the remote is queried to determine its `HEAD`, then
105-
`$GIT_DIR/remotes/<name>/HEAD` is set to the same branch. e.g., if the remote
105+
With `-a`, the remote is queried to determine its `HEAD`, then the
106+
symbolic-ref `refs/remotes/<name>/HEAD` is set to the same branch. e.g., if the remote
106107
`HEAD` is pointed at `next`, "`git remote set-head origin -a`" will set
107-
`$GIT_DIR/refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will
108+
the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will
108109
only work if `refs/remotes/origin/next` already exists; if not it must be
109110
fetched first.
110111
+
111-
Use `<branch>` to set `$GIT_DIR/remotes/<name>/HEAD` explicitly. e.g., "git
112-
remote set-head origin master" will set `$GIT_DIR/refs/remotes/origin/HEAD` to
112+
Use `<branch>` to set the symbolic-ref `refs/remotes/<name>/HEAD` explicitly. e.g., "git
113+
remote set-head origin master" will set the symbolic-ref `refs/remotes/origin/HEAD` to
113114
`refs/remotes/origin/master`. This will only work if
114115
`refs/remotes/origin/master` already exists; if not it must be fetched first.
115116
+

Documentation/git.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,16 +523,15 @@ Any git command accepting any <object> can also use the following
523523
symbolic notation:
524524

525525
HEAD::
526-
indicates the head of the current branch (i.e. the
527-
contents of `$GIT_DIR/HEAD`).
526+
indicates the head of the current branch.
528527

529528
<tag>::
530529
a valid tag 'name'
531-
(i.e. the contents of `$GIT_DIR/refs/tags/<tag>`).
530+
(i.e. a `refs/tags/<tag>` reference).
532531

533532
<head>::
534533
a valid head 'name'
535-
(i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
534+
(i.e. a `refs/heads/<head>` reference).
536535

537536
For a more complete list of ways to spell object names, see
538537
"SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].

Documentation/glossary-content.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,17 @@ to point at the new commit.
161161

162162
[[def_head]]head::
163163
A <<def_ref,named reference>> to the <<def_commit,commit>> at the tip of a
164-
<<def_branch,branch>>. Heads are stored in
165-
`$GIT_DIR/refs/heads/`, except when using packed refs. (See
164+
<<def_branch,branch>>. Heads are stored in a file in
165+
`$GIT_DIR/refs/heads/` directory, except when using packed refs. (See
166166
linkgit:git-pack-refs[1].)
167167

168168
[[def_HEAD]]HEAD::
169169
The current <<def_branch,branch>>. In more detail: Your <<def_working_tree,
170170
working tree>> is normally derived from the state of the tree
171171
referred to by HEAD. HEAD is a reference to one of the
172172
<<def_head,heads>> in your repository, except when using a
173-
<<def_detached_HEAD,detached HEAD>>, in which case it may
174-
reference an arbitrary commit.
173+
<<def_detached_HEAD,detached HEAD>>, in which case it directly
174+
references an arbitrary commit.
175175

176176
[[def_head_ref]]head ref::
177177
A synonym for <<def_head,head>>.
@@ -382,8 +382,9 @@ should not be combined with other pathspec.
382382

383383
[[def_ref]]ref::
384384
A 40-byte hex representation of a <<def_SHA1,SHA1>> or a name that
385-
denotes a particular <<def_object,object>>. These may be stored in
386-
`$GIT_DIR/refs/`.
385+
denotes a particular <<def_object,object>>. They may be stored in
386+
a file under `$GIT_DIR/refs/` directory, or
387+
in the `$GIT_DIR/packed-refs` file.
387388

388389
[[def_reflog]]reflog::
389390
A reflog shows the local "history" of a ref. In other words,
@@ -459,14 +460,14 @@ should not be combined with other pathspec.
459460
command.
460461

461462
[[def_tag]]tag::
462-
A <<def_ref,ref>> pointing to a <<def_tag_object,tag>> or
463-
<<def_commit_object,commit object>>. In contrast to a <<def_head,head>>,
464-
a tag is not changed by a <<def_commit,commit>>. Tags (not
465-
<<def_tag_object,tag objects>>) are stored in `$GIT_DIR/refs/tags/`. A
466-
git tag has nothing to do with a Lisp tag (which would be
467-
called an <<def_object_type,object type>> in git's context). A
468-
tag is most typically used to mark a particular point in the
469-
commit ancestry <<def_chain,chain>>.
463+
A <<def_ref,ref>> under `refs/tags/` namespace that points to an
464+
object of an arbitrary type (typically a tag points to either a
465+
<<def_tag_object,tag>> or a <<def_commit_object,commit object>>).
466+
In contrast to a <<def_head,head>>, a tag is not updated by
467+
the `commit` command. A git tag has nothing to do with a Lisp
468+
tag (which would be called an <<def_object_type,object type>>
469+
in git's context). A tag is most typically used to mark a particular
470+
point in the commit ancestry <<def_chain,chain>>.
470471

471472
[[def_tag_object]]tag object::
472473
An <<def_object,object>> containing a <<def_ref,ref>> pointing to

0 commit comments

Comments
 (0)