Skip to content

Commit 6d81fe6

Browse files
committed
Merge branch 'kh/update-ref'
Documentation updates to 'git-update-ref(1)'. * kh/update-ref: Documentation: mutually link update-ref and symbolic-ref Documentation/git-update-ref.txt: discuss symbolic refs Documentation/git-update-ref.txt: remove confusing paragraph Documentation/git-update-ref.txt: demote symlink to last section Documentation/git-update-ref.txt: remove safety paragraphs Documentation/git-update-ref.txt: drop “flag”
2 parents aebc4bd + 18b0b6c commit 6d81fe6

File tree

2 files changed

+25
-27
lines changed

2 files changed

+25
-27
lines changed

Documentation/git-symbolic-ref.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ default.
7373
symbolic ref were printed correctly, with status 1 if the requested
7474
name is not a symbolic ref, or 128 if another error occurs.
7575

76+
SEE ALSO
77+
--------
78+
linkgit:git-update-ref[1]
79+
7680
GIT
7781
---
7882
Part of the linkgit:git[1] suite

Documentation/git-update-ref.txt

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,16 @@ value is <old-oid>. You can specify 40 "0" or an empty string
2525
as <old-oid> to make sure that the ref you are creating does
2626
not exist.
2727

28-
It also allows a "ref" file to be a symbolic pointer to another
29-
ref file by starting with the four-byte header sequence of
30-
"ref:".
31-
32-
More importantly, it allows the update of a ref file to follow
33-
these symbolic pointers, whether they are symlinks or these
34-
"regular file symbolic refs". It follows *real* symlinks only
35-
if they start with "refs/": otherwise it will just try to read
36-
them and update them as a regular file (i.e. it will allow the
37-
filesystem to follow them, but will overwrite such a symlink to
38-
somewhere else with a regular filename).
28+
The final arguments are object names; this command without any options
29+
does not support updating a symbolic ref to point to another ref (see
30+
linkgit:git-symbolic-ref[1]). But `git update-ref --stdin` does have
31+
the `symref-*` commands so that regular refs and symbolic refs can be
32+
committed in the same transaction.
3933

4034
If --no-deref is given, <ref> itself is overwritten, rather than
4135
the result of following the symbolic pointers.
4236

43-
In general, using
44-
45-
git update-ref HEAD "$head"
46-
47-
should be a _lot_ safer than doing
48-
49-
echo "$head" > "$GIT_DIR/HEAD"
50-
51-
both from a symlink following standpoint *and* an error checking
52-
standpoint. The "refs/" rule for symlinks means that symlinks
53-
that point to "outside" the tree are safe: they'll be followed
54-
for reading but not for writing (so we'll never write through a
55-
ref symlink to some other tree, if you have copied a whole
56-
archive by creating a symlink tree).
57-
58-
With `-d` flag, it deletes the named <ref> after verifying it
37+
With `-d`, it deletes the named <ref> after verifying that it
5938
still contains <old-oid>.
6039

6140
With `--stdin`, update-ref reads instructions from standard input and
@@ -200,6 +179,21 @@ An update will fail (without changing <ref>) if the current user is
200179
unable to create a new log file, append to the existing log file
201180
or does not have committer information available.
202181

182+
NOTES
183+
-----
184+
185+
Symbolic refs were initially implemented using symbolic links. This is
186+
now deprecated since not all filesystems support symbolic links.
187+
188+
This command follows *real* symlinks only if they start with "refs/":
189+
otherwise it will just try to read them and update them as a regular
190+
file (i.e. it will allow the filesystem to follow them, but will
191+
overwrite such a symlink to somewhere else with a regular filename).
192+
193+
SEE ALSO
194+
--------
195+
linkgit:git-symbolic-ref[1]
196+
203197
GIT
204198
---
205199
Part of the linkgit:git[1] suite

0 commit comments

Comments
 (0)