On 01/26/2016 09:42 AM, Konstantin Khomoutov wrote:
> On Tue, 26 Jan 2016 06:56:27 +0100 Pablo Rodríguez wrote:
>> I’m a git newbie and I wanted to stash a git repository containing
>> text files. There were some uncommited changes in some files.
>> I stashed with "git stash".
>> I corrected the two typos, committed with "git commit -p" and pushed
>> changes to GitHub with "git push origin master".
>> Since this was my first stash, I dropped the stash without having
>> applied it first (I didn’t know that I had to apply it).
> Didn't the word "drop" ring any bells for you? ;-)
> To drop is to get rid of, throw away etc.

Many thanks for your lengthy and highly instructive reply, Konstatin.
(And sorry for my excessively delayed answer [too much chaos here].)

Dropping a stash makes sense to me now. But as I did it was that the
files were reverted to its previous state before the stash.

Thinking about it now, even if remove or delete were used instead of
drop, I would make the same mistake. For the newbie, it didn’t help me
to read about stash drop before stash pop.

And what I had to do was to create a branch from the stash (reading it
right now from “Pro Git” book). Or at least, this is what I have to do
in the future.

> For the future, note that in normal (non-bare) Git repositories by
> default all "drastic head movements" are recorded in the so-called
> "reflog" which can be examined/controlled via the `git reflog` command.
> Branch deletions / forced updates (say via `git reset --hard` or
> `git branch -M`) are all recorded there.  Stash drops too.  This is a
> "safety belt" intended for recovering from occasional "oopsies" like
> yours.

Many thanks for this advice. What I see know is that "git reflog" only
shows a limited number of movements. Not all of them as with "git log".

As far as I know, all my repos are normal. I don’t know how to get
non-bare repositories (no idea of what these might be).

Many thanks for your reply,


You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to