Junio C Hamano | 1290563 | 2005-10-04 16:45:01 -0700 | [diff] [blame] | 1 | git-symbolic-ref(1) |
| 2 | =================== |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Johan Herland | 9ab55da | 2012-10-21 13:32:33 +0200 | [diff] [blame] | 6 | git-symbolic-ref - Read, modify and delete symbolic refs |
Junio C Hamano | 1290563 | 2005-10-04 16:45:01 -0700 | [diff] [blame] | 7 | |
| 8 | SYNOPSIS |
| 9 | -------- |
Martin von Zweigbergk | 7791a1d | 2011-07-01 22:38:26 -0400 | [diff] [blame] | 10 | [verse] |
Jan Krüger | 42b0059 | 2012-02-27 23:10:38 +0100 | [diff] [blame] | 11 | 'git symbolic-ref' [-m <reason>] <name> <ref> |
| 12 | 'git symbolic-ref' [-q] [--short] <name> |
Johan Herland | 9ab55da | 2012-10-21 13:32:33 +0200 | [diff] [blame] | 13 | 'git symbolic-ref' --delete [-q] <name> |
Junio C Hamano | 1290563 | 2005-10-04 16:45:01 -0700 | [diff] [blame] | 14 | |
| 15 | DESCRIPTION |
| 16 | ----------- |
| 17 | Given one argument, reads which branch head the given symbolic |
| 18 | ref refers to and outputs its path, relative to the `.git/` |
| 19 | directory. Typically you would give `HEAD` as the <name> |
Štěpán Němec | 75f492a | 2009-08-11 02:52:07 +0200 | [diff] [blame] | 20 | argument to see which branch your working tree is on. |
Junio C Hamano | 1290563 | 2005-10-04 16:45:01 -0700 | [diff] [blame] | 21 | |
Štěpán Němec | 75f492a | 2009-08-11 02:52:07 +0200 | [diff] [blame] | 22 | Given two arguments, creates or updates a symbolic ref <name> to |
Junio C Hamano | 1290563 | 2005-10-04 16:45:01 -0700 | [diff] [blame] | 23 | point at the given branch <ref>. |
| 24 | |
Johan Herland | 9ab55da | 2012-10-21 13:32:33 +0200 | [diff] [blame] | 25 | Given `--delete` and an additional argument, deletes the given |
| 26 | symbolic ref. |
| 27 | |
Andy Parkins | 22b1c7e | 2006-11-30 10:50:28 +0000 | [diff] [blame] | 28 | A symbolic ref is a regular file that stores a string that |
| 29 | begins with `ref: refs/`. For example, your `.git/HEAD` is |
| 30 | a regular file whose contents is `ref: refs/heads/master`. |
| 31 | |
Junio C Hamano | a0f4280 | 2007-01-15 13:56:05 -0800 | [diff] [blame] | 32 | OPTIONS |
| 33 | ------- |
| 34 | |
Johan Herland | 9ab55da | 2012-10-21 13:32:33 +0200 | [diff] [blame] | 35 | -d:: |
| 36 | --delete:: |
| 37 | Delete the symbolic ref <name>. |
| 38 | |
Stephan Beyer | 3240240 | 2008-06-08 03:36:09 +0200 | [diff] [blame] | 39 | -q:: |
| 40 | --quiet:: |
Junio C Hamano | a0f4280 | 2007-01-15 13:56:05 -0800 | [diff] [blame] | 41 | Do not issue an error message if the <name> is not a |
| 42 | symbolic ref but a detached HEAD; instead exit with |
| 43 | non-zero status silently. |
| 44 | |
Jan Krüger | 42b0059 | 2012-02-27 23:10:38 +0100 | [diff] [blame] | 45 | --short:: |
| 46 | When showing the value of <name> as a symbolic ref, try to shorten the |
| 47 | value, e.g. from `refs/heads/master` to `master`. |
| 48 | |
Nicolas Pitre | 8b5157e | 2007-01-26 17:26:10 -0500 | [diff] [blame] | 49 | -m:: |
| 50 | Update the reflog for <name> with <reason>. This is valid only |
| 51 | when creating or updating a symbolic ref. |
| 52 | |
Andy Parkins | 22b1c7e | 2006-11-30 10:50:28 +0000 | [diff] [blame] | 53 | NOTES |
| 54 | ----- |
| 55 | In the past, `.git/HEAD` was a symbolic link pointing at |
| 56 | `refs/heads/master`. When we wanted to switch to another branch, |
| 57 | we did `ln -sf refs/heads/newbranch .git/HEAD`, and when we wanted |
Junio C Hamano | 1290563 | 2005-10-04 16:45:01 -0700 | [diff] [blame] | 58 | to find out which branch we are on, we did `readlink .git/HEAD`. |
Michael Haggerty | a8d05d7 | 2011-12-07 16:20:16 +0100 | [diff] [blame] | 59 | But symbolic links are not entirely portable, so they are now |
| 60 | deprecated and symbolic refs (as described above) are used by |
| 61 | default. |
Junio C Hamano | 1290563 | 2005-10-04 16:45:01 -0700 | [diff] [blame] | 62 | |
Thomas Rast | 0b444cd | 2010-01-10 00:33:00 +0100 | [diff] [blame] | 63 | 'git symbolic-ref' will exit with status 0 if the contents of the |
Jeff King | a74b170 | 2007-01-15 17:25:33 -0500 | [diff] [blame] | 64 | symbolic ref were printed correctly, with status 1 if the requested |
| 65 | name is not a symbolic ref, or 128 if another error occurs. |
| 66 | |
Junio C Hamano | 1290563 | 2005-10-04 16:45:01 -0700 | [diff] [blame] | 67 | GIT |
| 68 | --- |
Christian Couder | 9e1f0a8 | 2008-06-06 09:07:32 +0200 | [diff] [blame] | 69 | Part of the linkgit:git[1] suite |