[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

finding misplaced changes with git

From: Ralf Wildenhues
Subject: finding misplaced changes with git
Date: Tue, 22 Jul 2008 07:28:30 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Jim, all,

in a recent commit you write

|     * HACKING: describe how to find a misplaced change-set

| --- a/HACKING
| +++ b/HACKING
| @@ -360,6 +360,22 @@ 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.

Using 'git fsck' for this purpose may be fine, but it is unnecessarily
expensive.  In this special case, the 'git reflog' output will lead you
to the dangling commit right away, without any searching or guessing.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]