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' [-m <reason>] <name> <ref> 12'git symbolic-ref' [-q] [--short] <name> 13 14DESCRIPTION 15----------- 16Given one argument, reads which branch head the given symbolic 17ref refers to and outputs its path, relative to the `.git/` 18directory. Typically you would give `HEAD` as the <name> 19argument to see which branch your working tree is on. 20 21Given two arguments, creates or updates a symbolic ref <name> to 22point at the given branch <ref>. 23 24A symbolic ref is a regular file that stores a string that 25begins with `ref: refs/`. For example, your `.git/HEAD` is 26a regular file whose contents is `ref: refs/heads/master`. 27 28OPTIONS 29------- 30 31-q:: 32--quiet:: 33 Do not issue an error message if the <name> is not a 34 symbolic ref but a detached HEAD; instead exit with 35 non-zero status silently. 36 37--short:: 38 When showing the value of <name> as a symbolic ref, try to shorten the 39 value, e.g. from `refs/heads/master` to `master`. 40 41-m:: 42 Update the reflog for <name> with <reason>. This is valid only 43 when creating or updating a symbolic ref. 44 45NOTES 46----- 47In the past, `.git/HEAD` was a symbolic link pointing at 48`refs/heads/master`. When we wanted to switch to another branch, 49we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted 50to find out which branch we are on, we did `readlink .git/HEAD`. 51But symbolic links are not entirely portable, so they are now 52deprecated and symbolic refs (as described above) are used by 53default. 54 55'git symbolic-ref' will exit with status 0 if the contents of the 56symbolic ref were printed correctly, with status 1 if the requested 57name is not a symbolic ref, or 128 if another error occurs. 58 59GIT 60--- 61Part of the linkgit:git[1] suite