2 .\" Title: git-symbolic-ref
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
10 .TH "GIT\-SYMBOLIC\-REF" "1" "2024-11-01" "\ \&" "\ \&"
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>
41 Given one argument, reads which branch head the given symbolic ref refers to and outputs its path, relative to the \&.\fBgit/\fR directory\&. Typically you would give \fBHEAD\fR as the <name> argument to see which branch your working tree is on\&.
43 Given two arguments, creates or updates a symbolic ref <name> to point at the given branch <ref>\&.
45 Given \fB\-\-delete\fR and an additional argument, deletes the given symbolic ref\&.
47 A symbolic ref is a regular file that stores a string that begins with \fBref:\fR \fBrefs/\fR\&. For example, your \&.\fBgit/HEAD\fR is a regular file whose content is \fBref:\fR \fBrefs/heads/master\fR\&.
52 Delete the symbolic ref <name>\&.
57 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\&.
62 When showing the value of <name> as a symbolic ref, try to shorten the value, e\&.g\&. from
63 \fBrefs/heads/master\fR
68 \-\-recurse, \-\-no\-recurse
70 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)\&.
72 stops after dereferencing only a single level of symbolic ref\&.
77 Update the reflog for <name> with <reason>\&. This is valid only when creating or updating a symbolic ref\&.
81 In the past, \&.\fBgit/HEAD\fR was a symbolic link pointing at \fBrefs/heads/master\fR\&. When we wanted to switch to another branch, we did \fBln\fR \fB\-sf\fR \fBrefs/heads/newbranch\fR \fB\&.git/HEAD\fR, and when we wanted to find out which branch we are on, we did \fBreadlink\fR \fB\&.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\&.
83 \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\&.
86 \fBgit-update-ref\fR(1)
89 Part of the \fBgit\fR(1) suite