Git fork
1git-symbolic-ref(1)
2===================
3
4NAME
5----
6git-symbolic-ref - Read, modify and delete symbolic refs
7
8SYNOPSIS
9--------
10[verse]
11'git symbolic-ref' [-m <reason>] <name> <ref>
12'git symbolic-ref' [-q] [--short] [--no-recurse] <name>
13'git symbolic-ref' --delete [-q] <name>
14
15DESCRIPTION
16-----------
17Given one argument, reads which branch head the given symbolic
18ref refers to and outputs its path, relative to the `.git/`
19directory. Typically you would give `HEAD` as the <name>
20argument to see which branch your working tree is on.
21
22Given two arguments, creates or updates a symbolic ref <name> to
23point at the given branch <ref>.
24
25Given `--delete` and an additional argument, deletes the given
26symbolic ref.
27
28A symbolic ref is a regular file that stores a string that
29begins with `ref: refs/`. For example, your `.git/HEAD` is
30a regular file whose content is `ref: refs/heads/master`.
31
32OPTIONS
33-------
34
35-d::
36--delete::
37 Delete the symbolic ref <name>.
38
39-q::
40--quiet::
41 Do not issue an error message if the <name> is not a
42 symbolic ref but a detached HEAD; instead exit with
43 non-zero status silently.
44
45--short::
46 When showing the value of <name> as a symbolic ref, try to shorten the
47 value, e.g. from `refs/heads/master` to `master`.
48
49--recurse::
50--no-recurse::
51 When showing the value of <name> as a symbolic ref, if
52 <name> refers to another symbolic ref, follow such a chain
53 of symbolic refs until the result no longer points at a
54 symbolic ref (`--recurse`, which is the default).
55 `--no-recurse` stops after dereferencing only a single level
56 of symbolic ref.
57
58-m::
59 Update the reflog for <name> with <reason>. This is valid only
60 when creating or updating a symbolic ref.
61
62NOTES
63-----
64In the past, `.git/HEAD` was a symbolic link pointing at
65`refs/heads/master`. When we wanted to switch to another branch,
66we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted
67to find out which branch we are on, we did `readlink .git/HEAD`.
68But symbolic links are not entirely portable, so they are now
69deprecated and symbolic refs (as described above) are used by
70default.
71
72'git symbolic-ref' will exit with status 0 if the contents of the
73symbolic ref were printed correctly, with status 1 if the requested
74name is not a symbolic ref, or 128 if another error occurs.
75
76SEE ALSO
77--------
78linkgit:git-update-ref[1]
79
80GIT
81---
82Part of the linkgit:git[1] suite