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