bug-gnulib
[Top][All Lists]
Advanced

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

Re: git: avoiding merges, rebasing


From: Benoit SIGOURE
Subject: Re: git: avoiding merges, rebasing
Date: Tue, 2 Oct 2007 09:01:43 +0200

[I forgot to reply all, sorry Bruno -- I also edited the end of the message]

On Oct 2, 2007, at 3:47 AM, Bruno Haible wrote:

Hi,

  $ git stash
  $ git fetch
  $ git rebase origin/master
  $ git stash apply
  <resolve conflicts>
  $ git stash clear
  $ git reset

Note that "git stash clear" is a dangerous command. I recommend to use it
only after "git stash list" and/or "git status".

I just did this:

    $ git stash
    $ git pull
    $ git stash apply
    $ git stash clean              ; typo!
    $ git stash clear              ; fatal correction to typo!

and lost 20 modified files. Well, not really lost. Just took me a while to

I don't really see how and why you "lost 20 modified files".

recover them by
  - looking for the most recently changed files in .git/objects/,
  - use "git cat-file blob xxxx" on each,
  - assign the blobs to file names.

Is there some shorthand for this process, such as a "git-recover" command?

Normally you can use git-reflog for this sort of mistake but stashes are implemented with reflog so it's not possible to recover through this mechanism. On the other hand, you can run git fsck and look for a dangling commit (which can be inspected with git show <sha1>) where you are most likely to find your stash (unless you run git-gc or this sort of thing).

Someone just told me on IRC that you can also use git lost-found (which worked for me).

Cheers,

--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory


Attachment: PGP.sig
Description: This is a digitally signed message part


reply via email to

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