user-manual: update references discussion
Since references may be packed, it's no longer as helpful to introduce references as paths relative to .git. Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
This commit is contained in:
parent
fe4b3e591b
commit
f60b964249
@ -506,41 +506,33 @@ Note that the name "origin" is just the name that git uses by default
|
|||||||
to refer to the repository that you cloned from.
|
to refer to the repository that you cloned from.
|
||||||
|
|
||||||
[[how-git-stores-references]]
|
[[how-git-stores-references]]
|
||||||
How git stores references
|
Naming branches, tags, and other references
|
||||||
-------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
Branches, remote-tracking branches, and tags are all references to
|
Branches, remote-tracking branches, and tags are all references to
|
||||||
commits. Git stores these references in the ".git" directory. Most
|
commits. All references are named with a slash-separated path name
|
||||||
of them are stored in .git/refs/:
|
starting with "refs"; the names we've been using so far are actually
|
||||||
|
shorthand:
|
||||||
|
|
||||||
- branches are stored in .git/refs/heads
|
- The branch "test" is short for "refs/heads/test".
|
||||||
- tags are stored in .git/refs/tags
|
- The tag "v2.6.18" is short for "refs/tags/v2.6.18".
|
||||||
- remote-tracking branches for "origin" are stored in
|
- "origin/master" is short for "refs/remotes/origin/master".
|
||||||
.git/refs/remotes/origin/
|
|
||||||
|
|
||||||
If you look at one of these files you will see that they usually
|
The full name is occasionally useful if, for example, there ever
|
||||||
contain just the SHA1 id of a commit:
|
exists a tag and a branch with the same name.
|
||||||
|
|
||||||
------------------------------------------------
|
As another useful shortcut, if the repository "origin" posesses only
|
||||||
$ ls .git/refs/heads/
|
a single branch, you can refer to that branch as just "origin".
|
||||||
master
|
|
||||||
$ cat .git/refs/heads/master
|
|
||||||
c0f982dcf188d55db9d932a39d4ea7becaa55fed
|
|
||||||
------------------------------------------------
|
|
||||||
|
|
||||||
You can refer to a reference by its path relative to the .git
|
More generally, if you have defined a remote repository named
|
||||||
directory. However, we've seen above that git will also accept
|
"example", you can refer to the branch in that repository as
|
||||||
shorter names; for example, "master" is an acceptable shortcut for
|
"example". And for a repository with multiple branches, this will
|
||||||
"refs/heads/master", and "origin/master" is a shortcut for
|
refer to the branch designated as the "HEAD" branch.
|
||||||
"refs/remotes/origin/master".
|
|
||||||
|
|
||||||
As another useful shortcut, you can also refer to the "HEAD" of
|
|
||||||
"origin" (or any other remote), using just the name of the remote.
|
|
||||||
|
|
||||||
For the complete list of paths which git checks for references, and
|
For the complete list of paths which git checks for references, and
|
||||||
how it decides which to choose when there are multiple references
|
the order it uses to decide which to choose when there are multiple
|
||||||
with the same name, see the "SPECIFYING REVISIONS" section of
|
references with the same shorthand name, see the "SPECIFYING
|
||||||
gitlink:git-rev-parse[1].
|
REVISIONS" section of gitlink:git-rev-parse[1].
|
||||||
|
|
||||||
[[Updating-a-repository-with-git-fetch]]
|
[[Updating-a-repository-with-git-fetch]]
|
||||||
Updating a repository with git fetch
|
Updating a repository with git fetch
|
||||||
|
Loading…
Reference in New Issue
Block a user