user-manual: more discussion of detached heads, fix typos
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>
J. Bruce Fields committed
Apr 18, 2007 at 00:20 UTC
953f3d6ff939b3c51d6c733a3d0e3f54e7477034
1 file changed
+15
-5
Documentation/user-manual.txt
+15
-5
@@ -527,17 +527,16 @@ and git branch shows that you are no longer on a branch:
527
------------------------------------------------
528
$ cat .git/HEAD
529
427abfa28afedffadfca9dd8b067eb6d36bac53f
530
-git branch
530
+$ git branch
531
* (no branch)
532
master
533
------------------------------------------------
534
535
In this case we say that the HEAD is "detached".
536
537
-This can be an easy way to check out a particular version without having
538
-to make up a name for a new branch. However, keep in mind that when you
539
-switch away from the (for example, by checking out something else), you
540
-can lose track of what the HEAD used to point to.
537
+This is an easy way to check out a particular version without having to
538
+make up a name for the new branch. You can still create a new branch
539
+(or tag) for this version later if you decide to.
540
541
Examining branches from a remote repository
542
-------------------------------------------
@@ -1560,8 +1559,19 @@ $ git show master@{2} # See where the branch pointed 2,
1559
$ git show master@{3} # 3, ... changes ago.
1560
$ gitk master@{yesterday} # See where it pointed yesterday,
1561
$ gitk master@{"1 week ago"} # ... or last week
1562
+$ git log --walk-reflogs master # show reflog entries for master
1563
+-------------------------------------------------
1564
+
1565
+A separate reflog is kept for the HEAD, so
1566
+
1567
+-------------------------------------------------
1568
+$ git show HEAD@{"1 week ago"}
1569
-------------------------------------------------
1570
1571
+will show what HEAD pointed to one week ago, not what the current branch
1572
+pointed to one week ago. This allows you to see the history of what
1573
+you've checked out.
1574
+
1575
The reflogs are kept by default for 30 days, after which they may be
1576
pruned. See gitlink:git-reflog[1] and gitlink:git-gc[1] to learn
1577
how to control this pruning, and see the "SPECIFYING REVISIONS"