summaryrefslogtreecommitdiff
path: root/devdocs/git/git-symbolic-ref.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/git/git-symbolic-ref.html')
-rw-r--r--devdocs/git/git-symbolic-ref.html8
1 files changed, 8 insertions, 0 deletions
diff --git a/devdocs/git/git-symbolic-ref.html b/devdocs/git/git-symbolic-ref.html
new file mode 100644
index 00000000..90abc125
--- /dev/null
+++ b/devdocs/git/git-symbolic-ref.html
@@ -0,0 +1,8 @@
+<h1>git-symbolic-ref</h1> <h2 id="_name">Name</h2> <div class="sectionbody"> <p>git-symbolic-ref - Read, modify and delete symbolic refs</p> </div> <h2 id="_synopsis">Synopsis</h2> <div class="sectionbody"> <div class="verseblock"> <pre class="content" data-language="shell">git symbolic-ref [-m &lt;reason&gt;] &lt;name&gt; &lt;ref&gt;
+git symbolic-ref [-q] [--short] [--no-recurse] &lt;name&gt;
+git symbolic-ref --delete [-q] &lt;name&gt;</pre> </div> </div> <h2 id="_description">Description</h2> <div class="sectionbody"> <p>Given one argument, reads which branch head the given symbolic ref refers to and outputs its path, relative to the <code>.git/</code> directory. Typically you would give <code>HEAD</code> as the &lt;name&gt; argument to see which branch your working tree is on.</p> <p>Given two arguments, creates or updates a symbolic ref &lt;name&gt; to point at the given branch &lt;ref&gt;.</p> <p>Given <code>--delete</code> and an additional argument, deletes the given symbolic ref.</p> <p>A symbolic ref is a regular file that stores a string that begins with <code>ref: refs/</code>. For example, your <code>.git/HEAD</code> is a regular file whose content is <code>ref: refs/heads/master</code>.</p> </div> <h2 id="_options">Options</h2> <div class="sectionbody"> <div class="dlist"> <dl> <dt class="hdlist1" id="Documentation/git-symbolic-ref.txt--d"> -d </dt> <dt class="hdlist1" id="Documentation/git-symbolic-ref.txt---delete"> --delete </dt> <dd> <p>Delete the symbolic ref &lt;name&gt;.</p> </dd> <dt class="hdlist1" id="Documentation/git-symbolic-ref.txt--q"> -q </dt> <dt class="hdlist1" id="Documentation/git-symbolic-ref.txt---quiet"> --quiet </dt> <dd> <p>Do not issue an error message if the &lt;name&gt; is not a symbolic ref but a detached HEAD; instead exit with non-zero status silently.</p> </dd> <dt class="hdlist1" id="Documentation/git-symbolic-ref.txt---short"> --short </dt> <dd> <p>When showing the value of &lt;name&gt; as a symbolic ref, try to shorten the value, e.g. from <code>refs/heads/master</code> to <code>master</code>.</p> </dd> <dt class="hdlist1" id="Documentation/git-symbolic-ref.txt---recurse"> --recurse </dt> <dt class="hdlist1" id="Documentation/git-symbolic-ref.txt---no-recurse"> --no-recurse </dt> <dd> <p>When showing the value of &lt;name&gt; as a symbolic ref, if &lt;name&gt; refers to another symbolic ref, follow such a chain of symbolic refs until the result no longer points at a symbolic ref (<code>--recurse</code>, which is the default). <code>--no-recurse</code> stops after dereferencing only a single level of symbolic ref.</p> </dd> <dt class="hdlist1" id="Documentation/git-symbolic-ref.txt--m"> -m </dt> <dd> <p>Update the reflog for &lt;name&gt; with &lt;reason&gt;. This is valid only when creating or updating a symbolic ref.</p> </dd> </dl> </div> </div> <h2 id="_notes">Notes</h2> <div class="sectionbody"> <p>In the past, <code>.git/HEAD</code> was a symbolic link pointing at <code>refs/heads/master</code>. When we wanted to switch to another branch, we did <code>ln -sf refs/heads/newbranch .git/HEAD</code>, and when we wanted to find out which branch we are on, we did <code>readlink .git/HEAD</code>. But symbolic links are not entirely portable, so they are now deprecated and symbolic refs (as described above) are used by default.</p> <p><code>git symbolic-ref</code> 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.</p> </div><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; 2012&ndash;2024 Scott Chacon and others<br>Licensed under the MIT License.<br>
+ <a href="https://git-scm.com/docs/git-symbolic-ref" class="_attribution-link">https://git-scm.com/docs/git-symbolic-ref</a>
+ </p>
+</div>