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

NAME

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

SYNOPSIS

9       git symbolic-ref [-m <reason>] <name> <ref>
10       git symbolic-ref [-q] [--short] <name>
11       git symbolic-ref --delete [-q] <name>
12

DESCRIPTION

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

OPTIONS

30       -d, --delete
31           Delete the symbolic ref <name>.
32
33       -q, --quiet
34           Do not issue an error message if the <name> is not a symbolic ref
35           but a detached HEAD; instead exit with non-zero status silently.
36
37       --short
38           When showing the value of <name> as a symbolic ref, try to shorten
39           the value, e.g. from refs/heads/master to master.
40
41       -m
42           Update the reflog for <name> with <reason>. This is valid only when
43           creating or updating a symbolic ref.
44

NOTES

46       In the past, .git/HEAD was a symbolic link pointing at
47       refs/heads/master. When we wanted to switch to another branch, we did
48       ln -sf refs/heads/newbranch .git/HEAD, and when we wanted to find out
49       which branch we are on, we did readlink .git/HEAD. But symbolic links
50       are not entirely portable, so they are now deprecated and symbolic refs
51       (as described above) are used by default.
52
53       git symbolic-ref will exit with status 0 if the contents of the
54       symbolic ref were printed correctly, with status 1 if the requested
55       name is not a symbolic ref, or 128 if another error occurs.
56

GIT

58       Part of the git(1) suite
59
60
61
62Git 2.30.2                        2021-03-08               GIT-SYMBOLIC-REF(1)
Impressum