Re: can git reset or checkout be reverted?

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

 



On 2009-02-06, bill lam <cbill.lam@xxxxxxxxx> wrote:
> If I want to recall a old version of testing by
>
> git reset --hard sha1
> or
> git checkout sha1
>
> then git log does not show anything beyond that commit. It does give
> some warning and recommend -b switch next time.  If I only do that by
> accident or ignorance.  How to revert to the original HEAD?

As others have said: reflog.

I just wanted to add, I've had a lot of luck using reflog's
@{now} feature:

    git reflog show @{now}

Coupled with a vague recollection of what action I did at
what time, this has saved me a few times, and if I've been
jumping around branches as well, then:

    git reflog show HEAD@{now}

Another good one is:

    git show-branch --sha1-name -g=5

(or some larger value depending on how big your xterm is.)
This is particularly useful when I've done a lot of 'git
commit --amend' or rebases; the top most '+' sign in each
column, starting from the left, is your reflog -- I don't
know who came up with this design but it's amazing how much
useful information is condensed into that display.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux