Skip to content

Commit 22b1c7e

Browse files
andyparkinsJunio C Hamano
authored andcommitted
De-emphasise the symbolic link documentation.
The fact that git has previously used symbolic links for representing symbolic refs doesn't seem relevant to the current function of git-symbolic-ref. This patch makes less of a big deal about the symbolic link history and instead focuses on what git does now. Signed-off-by: Andy Parkins <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4c81c21 commit 22b1c7e

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

Documentation/git-symbolic-ref.txt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,22 @@ argument to see on which branch your working tree is on.
1919
Give two arguments, create or update a symbolic ref <name> to
2020
point at the given branch <ref>.
2121

22-
Traditionally, `.git/HEAD` is a symlink pointing at
23-
`refs/heads/master`. When we want to switch to another branch,
24-
we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we want
22+
A symbolic ref is a regular file that stores a string that
23+
begins with `ref: refs/`. For example, your `.git/HEAD` is
24+
a regular file whose contents is `ref: refs/heads/master`.
25+
26+
NOTES
27+
-----
28+
In the past, `.git/HEAD` was a symbolic link pointing at
29+
`refs/heads/master`. When we wanted to switch to another branch,
30+
we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted
2531
to find out which branch we are on, we did `readlink .git/HEAD`.
2632
This was fine, and internally that is what still happens by
2733
default, but on platforms that do not have working symlinks,
2834
or that do not have the `readlink(1)` command, this was a bit
2935
cumbersome. On some platforms, `ln -sf` does not even work as
30-
advertised (horrors).
31-
32-
A symbolic ref can be a regular file that stores a string that
33-
begins with `ref: refs/`. For example, your `.git/HEAD` *can*
34-
be a regular file whose contents is `ref: refs/heads/master`.
35-
This can be used on a filesystem that does not support symbolic
36-
links. Instead of doing `readlink .git/HEAD`, `git-symbolic-ref
37-
HEAD` can be used to find out which branch we are on. To point
38-
the HEAD to `newbranch`, instead of `ln -sf refs/heads/newbranch
39-
.git/HEAD`, `git-symbolic-ref HEAD refs/heads/newbranch` can be
40-
used.
41-
42-
Currently, .git/HEAD uses a regular file symbolic ref on Cygwin,
43-
and everywhere else it is implemented as a symlink. This can be
44-
changed at compilation time.
36+
advertised (horrors). Therefore symbolic links are now deprecated
37+
and symbolic refs are used by default.
4538

4639
Author
4740
------

0 commit comments

Comments
 (0)