This isn't the sort of thing you do every day, but it's handy not to have to dig through documentation for a recipe:
Here's a proposed change to HACKING: >From a28d580f4729170f26a7ec40a19ee4d6301acf3d Mon Sep 17 00:00:00 2001 From: Jim Meyering <[EMAIL PROTECTED]> Date: Wed, 16 Jul 2008 12:25:00 +0200 Subject: [PATCH] * HACKING: describe how to find a misplaced change-set --- HACKING | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/HACKING b/HACKING index 457048e..7d8bcb3 100644 --- a/HACKING +++ b/HACKING @@ -360,6 +360,20 @@ Miscellaneous useful git commands you an interface with which you can reorder and modify arbitrary change sets on that branch. + * if you "misplace" a change set, i.e., via git reset --hard ..., so that + it's no longer reachable by any branch, you can use "git fsck" to find + its SHA1 and then tag it or cherry-pick it onto an existing branch. + For example, run this: + git fsck --lost-found HEAD && cd .git/lost-found/commit \ + && for i in *; do git show $i|grep SOME_IDENTIFYING_STRING \ + && echo $i; done + The "git fsck ..." command creates the .git/lost-found/... hierarchy + listing all unreachable objects. Then the for loop + print SHA1s for commits that match via log or patch. + For example, say that found 556fbb57216b119155cdda824c98dc579b8121c8, + you could run "git show 556fbb57216b119" to examine the change set, + or "git checkout -b found 556fbb5721" to give it a branch name. + ------------------------------------------- Finding things to do -- 1.5.6.3.386.gc8666 _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils