Re: [PATCH] Document 'stash clear' recovery via unreachable commits

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

 



On 2009.08.08 18:25:55 -0700, Junio C Hamano wrote:
> Thomas Rast <trast@xxxxxxxxxxxxxxx> writes:
> 
> > Add an example to the stash documentation that shows how to quickly
> > find candidate commits among the 'git fsck --unreachable' output.
> 
> Thanks.
> 
> > Unless you have merges of branch names containing WIP, or edit your
> > merge messages to say WIP, there will be no false positives.
> 
> That may be true, but I suspect that people's stash entries that are worth
> saving are given their own messages with "git stash save 'message'" and do
> not necessarily say WIP.  I wish if there were a better way to identify
> them, but I do not think of any offhand.

Here's what I have now:

git fsck --unreachable | grep commit | cut -d\  -f3 |
xargs git log --no-walk --merges \
	--grep='^\(WIP on \|On \)\((no branch)\|[^ ]\+\):'

Should catch stashes with and without user-supplied messages and avoid
most false-positives. Drop the "WIP on " option from the grep to capture
just those that have a user-supplied message.

To try really really hard to get stash stuff only, one could add some
extra stuff to verify that the second parent's commit message is
"index on \2:" (\2 being the second group from the above --grep). But
that's probably total overkill...

Björn
--
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]