]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-symbolic-ref.txt
git reflog expire: document --stale-fix option.
[thirdparty/git.git] / Documentation / git-symbolic-ref.txt
CommitLineData
12905637
JH
1git-symbolic-ref(1)
2===================
3
4NAME
5----
6git-symbolic-ref - read and modify symbolic refs
7
8SYNOPSIS
9--------
10'git-symbolic-ref' <name> [<ref>]
11
12DESCRIPTION
13-----------
14Given one argument, reads which branch head the given symbolic
15ref refers to and outputs its path, relative to the `.git/`
16directory. Typically you would give `HEAD` as the <name>
17argument to see on which branch your working tree is on.
18
19Give two arguments, create or update a symbolic ref <name> to
20point at the given branch <ref>.
21
22b1c7ee
AP
22A symbolic ref is a regular file that stores a string that
23begins with `ref: refs/`. For example, your `.git/HEAD` is
24a regular file whose contents is `ref: refs/heads/master`.
25
26NOTES
27-----
28In the past, `.git/HEAD` was a symbolic link pointing at
29`refs/heads/master`. When we wanted to switch to another branch,
30we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted
12905637
JH
31to find out which branch we are on, we did `readlink .git/HEAD`.
32This was fine, and internally that is what still happens by
27dedf0c
JH
33default, but on platforms that do not have working symlinks,
34or that do not have the `readlink(1)` command, this was a bit
12905637 35cumbersome. On some platforms, `ln -sf` does not even work as
22b1c7ee
AP
36advertised (horrors). Therefore symbolic links are now deprecated
37and symbolic refs are used by default.
12905637
JH
38
39Author
40------
41Written by Junio C Hamano <junkio@cox.net>
42
43GIT
44---
45Part of the gitlink:git[7] suite