summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e102d43)
raw | patch | inline | side by side (parent: e102d43)
author | J. Bruce Fields <bfields@citi.umich.edu> | |
Wed, 18 Apr 2007 04:20:46 +0000 (00:20 -0400) | ||
committer | J. Bruce Fields <bfields@citi.umich.edu> | |
Mon, 7 May 2007 05:03:52 +0000 (01:03 -0400) |
Nicolas Pitre pointed out a couple typos and some room for improvement
in the discussion of detached heads.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Cc: Nicolas Pitre <nico@cam.org>
in the discussion of detached heads.
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Cc: Nicolas Pitre <nico@cam.org>
Documentation/user-manual.txt | patch | blob | history |
index dff438f76871ecdc84fe8b42c071bdab48149f3f..54fd41384688932d26918d2a44d84516bc99a039 100644 (file)
------------------------------------------------
$ cat .git/HEAD
427abfa28afedffadfca9dd8b067eb6d36bac53f
-git branch
+$ git branch
* (no branch)
master
------------------------------------------------
In this case we say that the HEAD is "detached".
-This can be an easy way to check out a particular version without having
-to make up a name for a new branch. However, keep in mind that when you
-switch away from the (for example, by checking out something else), you
-can lose track of what the HEAD used to point to.
+This is an easy way to check out a particular version without having to
+make up a name for the new branch. You can still create a new branch
+(or tag) for this version later if you decide to.
Examining branches from a remote repository
-------------------------------------------
$ git show master@{3} # 3, ... changes ago.
$ gitk master@{yesterday} # See where it pointed yesterday,
$ gitk master@{"1 week ago"} # ... or last week
+$ git log --walk-reflogs master # show reflog entries for master
+-------------------------------------------------
+
+A separate reflog is kept for the HEAD, so
+
+-------------------------------------------------
+$ git show HEAD@{"1 week ago"}
-------------------------------------------------
+will show what HEAD pointed to one week ago, not what the current branch
+pointed to one week ago. This allows you to see the history of what
+you've checked out.
+
The reflogs are kept by default for 30 days, after which they may be
pruned. See gitlink:git-reflog[1] and gitlink:git-gc[1] to learn
how to control this pruning, and see the "SPECIFYING REVISIONS"