1GIT-SYMBOLIC-REF(1)               Git Manual               GIT-SYMBOLIC-REF(1)
2
3
4

NAME

6       git-symbolic-ref - Read and modify symbolic refs
7

SYNOPSIS

9       git symbolic-ref [-q] [-m <reason>] <name> [<ref>]
10

DESCRIPTION

12       Given one argument, reads which branch head the given symbolic ref
13       refers to and outputs its path, relative to the .git/ directory.
14       Typically you would give HEAD as the <name> argument to see which
15       branch your working tree is on.
16
17       Given two arguments, creates or updates a symbolic ref <name> to point
18       at the given branch <ref>.
19
20       A symbolic ref is a regular file that stores a string that begins with
21       ref: refs/. For example, your .git/HEAD is a regular file whose
22       contents is ref: refs/heads/master.
23

OPTIONS

25       -q, --quiet
26           Do not issue an error message if the <name> is not a symbolic ref
27           but a detached HEAD; instead exit with non-zero status silently.
28
29       -m
30           Update the reflog for <name> with <reason>. This is valid only when
31           creating or updating a symbolic ref.
32

NOTES

34       In the past, .git/HEAD was a symbolic link pointing at
35       refs/heads/master. When we wanted to switch to another branch, we did
36       ln -sf refs/heads/newbranch .git/HEAD, and when we wanted to find out
37       which branch we are on, we did readlink .git/HEAD. This was fine, and
38       internally that is what still happens by default, but on platforms that
39       do not have working symlinks, or that do not have the readlink(1)
40       command, this was a bit cumbersome. On some platforms, ln -sf does not
41       even work as advertised (horrors). Therefore symbolic links are now
42       deprecated and symbolic refs are used by default.
43
44       git symbolic-ref will exit with status 0 if the contents of the
45       symbolic ref were printed correctly, with status 1 if the requested
46       name is not a symbolic ref, or 128 if another error occurs.
47

AUTHOR

49       Written by Junio C Hamano <gitster@pobox.com[1]>
50

GIT

52       Part of the git(1) suite
53

NOTES

55        1. gitster@pobox.com
56           mailto:gitster@pobox.com
57
58
59
60Git 1.7.1                         08/16/2017               GIT-SYMBOLIC-REF(1)
Impressum