Documentation / git-symbolic-ref.txton commit Merge branch 'mz/remote-rename' into maint-1.7.6 (716b64a)
   1git-symbolic-ref(1)
   2===================
   3
   4NAME
   5----
   6git-symbolic-ref - Read and modify symbolic refs
   7
   8SYNOPSIS
   9--------
  10[verse]
  11'git symbolic-ref' [-q] [-m <reason>] <name> [<ref>]
  12
  13DESCRIPTION
  14-----------
  15Given one argument, reads which branch head the given symbolic
  16ref refers to and outputs its path, relative to the `.git/`
  17directory.  Typically you would give `HEAD` as the <name>
  18argument to see which branch your working tree is on.
  19
  20Given two arguments, creates or updates a symbolic ref <name> to
  21point at the given branch <ref>.
  22
  23A symbolic ref is a regular file that stores a string that
  24begins with `ref: refs/`.  For example, your `.git/HEAD` is
  25a regular file whose contents is `ref: refs/heads/master`.
  26
  27OPTIONS
  28-------
  29
  30-q::
  31--quiet::
  32        Do not issue an error message if the <name> is not a
  33        symbolic ref but a detached HEAD; instead exit with
  34        non-zero status silently.
  35
  36-m::
  37        Update the reflog for <name> with <reason>.  This is valid only
  38        when creating or updating a symbolic ref.
  39
  40NOTES
  41-----
  42In the past, `.git/HEAD` was a symbolic link pointing at
  43`refs/heads/master`.  When we wanted to switch to another branch,
  44we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted
  45to find out which branch we are on, we did `readlink .git/HEAD`.
  46This was fine, and internally that is what still happens by
  47default, but on platforms that do not have working symlinks,
  48or that do not have the `readlink(1)` command, this was a bit
  49cumbersome.  On some platforms, `ln -sf` does not even work as
  50advertised (horrors).  Therefore symbolic links are now deprecated
  51and symbolic refs are used by default.
  52
  53'git symbolic-ref' will exit with status 0 if the contents of the
  54symbolic ref were printed correctly, with status 1 if the requested
  55name is not a symbolic ref, or 128 if another error occurs.
  56
  57GIT
  58---
  59Part of the linkgit:git[1] suite