2 .\" Title: git-symbolic-ref
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.40.1.423.g2807bd2c10
10 .TH "GIT\-SYMBOLIC\-REF" "1" "04/25/2023" "Git 2\&.40\&.1\&.423\&.g2807bd" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-symbolic-ref \- Read, modify and delete symbolic refs
35 \fIgit symbolic\-ref\fR [\-m <reason>] <name> <ref>
36 \fIgit symbolic\-ref\fR [\-q] [\-\-short] [\-\-no\-recurse] <name>
37 \fIgit symbolic\-ref\fR \-\-delete [\-q] <name>
42 Given one argument, reads which branch head the given symbolic ref refers to and outputs its path, relative to the \fB\&.git/\fR directory\&. Typically you would give \fBHEAD\fR as the <name> argument to see which branch your working tree is on\&.
44 Given two arguments, creates or updates a symbolic ref <name> to point at the given branch <ref>\&.
46 Given \fB\-\-delete\fR and an additional argument, deletes the given symbolic ref\&.
48 A symbolic ref is a regular file that stores a string that begins with \fBref: refs/\fR\&. For example, your \fB\&.git/HEAD\fR is a regular file whose contents is \fBref: refs/heads/master\fR\&.
53 Delete the symbolic ref <name>\&.
58 Do not issue an error message if the <name> is not a symbolic ref but a detached HEAD; instead exit with non\-zero status silently\&.
63 When showing the value of <name> as a symbolic ref, try to shorten the value, e\&.g\&. from
64 \fBrefs/heads/master\fR
69 \-\-recurse, \-\-no\-recurse
71 When showing the value of <name> as a symbolic ref, if <name> refers to another symbolic ref, follow such a chain of symbolic refs until the result no longer points at a symbolic ref (\fB\-\-recurse\fR, which is the default)\&.
73 stops after dereferencing only a single level of symbolic ref\&.
78 Update the reflog for <name> with <reason>\&. This is valid only when creating or updating a symbolic ref\&.
82 In the past, \fB\&.git/HEAD\fR was a symbolic link pointing at \fBrefs/heads/master\fR\&. When we wanted to switch to another branch, we did \fBln \-sf refs/heads/newbranch \&.git/HEAD\fR, and when we wanted to find out which branch we are on, we did \fBreadlink \&.git/HEAD\fR\&. But symbolic links are not entirely portable, so they are now deprecated and symbolic refs (as described above) are used by default\&.
84 \fIgit symbolic\-ref\fR will exit with status 0 if the contents of the symbolic ref were printed correctly, with status 1 if the requested name is not a symbolic ref, or 128 if another error occurs\&.
87 Part of the \fBgit\fR(1) suite