logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

git-symbolic-ref.1 (3830B)


  1. '\" t
  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/>
  5. .\" Date: 2025-03-14
  6. .\" Manual: Git Manual
  7. .\" Source: Git 2.49.0
  8. .\" Language: English
  9. .\"
  10. .TH "GIT\-SYMBOLIC\-REF" "1" "2025-03-14" "Git 2\&.49\&.0" "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. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. git-symbolic-ref \- Read, modify and delete symbolic refs
  32. .SH "SYNOPSIS"
  33. .sp
  34. .nf
  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>
  38. .fi
  39. .SH "DESCRIPTION"
  40. .sp
  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\&.
  42. .sp
  43. Given two arguments, creates or updates a symbolic ref <name> to point at the given branch <ref>\&.
  44. .sp
  45. Given \fB\-\-delete\fR and an additional argument, deletes the given symbolic ref\&.
  46. .sp
  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\&.
  48. .SH "OPTIONS"
  49. .PP
  50. \-d, \-\-delete
  51. .RS 4
  52. Delete the symbolic ref <name>\&.
  53. .RE
  54. .PP
  55. \-q, \-\-quiet
  56. .RS 4
  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\&.
  58. .RE
  59. .PP
  60. \-\-short
  61. .RS 4
  62. When showing the value of <name> as a symbolic ref, try to shorten the value, e\&.g\&. from
  63. \fBrefs/heads/master\fR
  64. to
  65. \fBmaster\fR\&.
  66. .RE
  67. .PP
  68. \-\-recurse, \-\-no\-recurse
  69. .RS 4
  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)\&.
  71. \fB\-\-no\-recurse\fR
  72. stops after dereferencing only a single level of symbolic ref\&.
  73. .RE
  74. .PP
  75. \-m
  76. .RS 4
  77. Update the reflog for <name> with <reason>\&. This is valid only when creating or updating a symbolic ref\&.
  78. .RE
  79. .SH "NOTES"
  80. .sp
  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\&.
  82. .sp
  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\&.
  84. .SH "SEE ALSO"
  85. .sp
  86. \fBgit-update-ref\fR(1)
  87. .SH "GIT"
  88. .sp
  89. Part of the \fBgit\fR(1) suite