[Top][All Lists]

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

Re: Stupid git!

From: David Kastrup
Subject: Re: Stupid git!
Date: Sat, 12 Sep 2015 12:40:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> Hello, Emacs.
> git has struck again, and another couple of hours valuable time have
> been lost.
> Having "staged" a change with `git add', I then tried to commit it with
> `git commit'.  Somebody else had got in before me, so I had to pull
> their changes first - fair enough.

Uh, no?  git commit goes to your local repository.  There is nobody else
who could "get in before you".  You never need to pull before
committing.  You may want to rebase after pulling, depending on your
kind of change.

> So I aborted this merge operation, in order to see what it's doing
> first.  git has kindly discarded my (staged) change, leaving no record
> of its existence - good job I've still got a copy of the changed file
> in Emacs.  Scrabbling around in the .git directory, I found the commit
> message in a file there.  So all is not lost.
> How do I see what changes are in file-notify-tests.el, which is in the
> staging area?

git diff --cached

> Time to save my changed file and have a coffee.  Isn't git wonderful!

When things start looking fishy, don't just stumble on blindly.  Save
what you got somewhere else, and _then_ try muddling through.  That's
not particular to Git.

David Kastrup

reply via email to

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