bug-gnulib
[Top][All Lists]
Advanced

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

Re: git: avoiding merges, rebasing


From: Bruno Haible
Subject: Re: git: avoiding merges, rebasing
Date: Thu, 4 Oct 2007 01:01:52 +0200
User-agent: KMail/1.5.4

Benoit SIGOURE wrote:
> >>> Is there some shorthand for this process, such as a "git-recover"
> >>> command?
> >>
> >> 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).
> >
> > Cool! This information would be worth mentioning in the git-stash  
> > manual page or in an FAQ. It can be a real life-saver.
> 
> True.  Propose a patch :-)

Here's a proposed patch.

--- git-1.5.3.4/Documentation/git-stash.txt.bak 2007-10-03 21:44:53.000000000 
+0200
+++ git-1.5.3.4/Documentation/git-stash.txt     2007-10-04 01:00:48.000000000 
+0200
@@ -154,6 +154,28 @@
 ... continue hacking ...
 ----------------------------------------------------------------
 
+Recovering a lost stash::
+
+`git stash clear` clears all stashes without asking for confirmation.
+If you did not intend this, you can recover the lost changes by running
+`git fsck`, looking for dangling commits, and using `git show <commit>`.
++
+----------------------------------------------------------------
+... hack hack hack ...
+$ git stash
+... hack no coffee hack ...
+$ git stash clear
+... panic panic ...
+$ git fsck
+dangling commit f62c4fa05422fd4fb8610bdb02a7160121657893
+dangling commit 773024d2ffc33ac80baddcf2b673535b627af0da
+dangling commit 9e509390a2b26b562f3b008eacc65b6765d48339
+$ git show 773024d2ffc33ac80baddcf2b673535b627af0da
+$ git diff 773024d2ffc33ac80baddcf2b673535b627af0da > recovered.diff
+$ patch -p0 -R < recovered.diff
+... continue hacking ...
+----------------------------------------------------------------
+
 SEE ALSO
 --------
 gitlink:git-checkout[1],





reply via email to

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