diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/git/git-symbolic-ref.html | |
new repository
Diffstat (limited to 'devdocs/git/git-symbolic-ref.html')
| -rw-r--r-- | devdocs/git/git-symbolic-ref.html | 8 |
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 <reason>] <name> <ref> +git symbolic-ref [-q] [--short] [--no-recurse] <name> +git symbolic-ref --delete [-q] <name></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 <name> argument to see which branch your working tree is on.</p> <p>Given two arguments, creates or updates a symbolic ref <name> to point at the given branch <ref>.</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 <name>.</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 <name> 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 <name> 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 <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 (<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 <name> with <reason>. 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"> + © 2012–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> |
