emacs-devel
[Top][All Lists]
Advanced

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

Re: git is screwed


From: Harald Hanche-Olsen
Subject: Re: git is screwed
Date: Wed, 01 Apr 2015 22:41:06 +0200
User-agent: Postbox 3.0.11 (Macintosh/20140602)

Maybe it is time to revisit this one, in light of what we have learned since.

Richard Stallman wrote:
I committed some changes using C-x v v in vc-dir.
Something went wrong with lisp/ChangeLog.

It appears that my change log entries went into an old version of that
file; I don't know why this happened, since I wrote them today after
doing 'git pull'.

(“today” in this email is March 22)

Ah, but we have the output of git reflog now:

dca743f address@hidden: commit: Recognize more format variation. Automatically reshow decrypted text.
1a80be1 address@hidden: commit: Echo area shows when displaying a mime message.
414e79f address@hidden: commit: Prefer IceCat to Firefox and Iceweasel.
f1cea3e address@hidden: checkout: moving from TEST to master
f1cea3e address@hidden: checkout: moving from master to TEST
f1cea3e address@hidden: pull: Fast-forward
3517da7 address@hidden: clone: from address@hidden:/srv/git/emacs.git

and there are no traces here of a successful pull after those three commits, which by the wat were all done in quick succession on March 22. The commit they are based on is f1cea3e, which is indeed about 8 weeks old. So it appears that your git pull failed, and you did edit an old lisp/ChangeLog.

After this, I did 'git pull' again, and it said there was a merge
conflict in lisp/ChangeLpg.  A lot of text appears to be missing from
the file.  It said, "fix conflicts and then commit the result."

I edited lisp/ChangeLog and tried to commit it with C-x v v.
That gave me the error message

   fatal: cannot do a partial commit during a merge.

I am now stuck.  […]

How can I get this unwedged?

We have also learned that “git ls-files -u” produces no output. That simplifies the available options somewhat, I think, since there are no unmerged files to deal with (they complicate the index quite a lot, since there may be several versions of these files there).

The only file different in the index and your working tree is lisp/ChangeLog. If you run “git diff”, you should see the difference between those two (in that order), and nothing else. If based on the output, you think the version in your working tree is more appropriate than the one in the index, you should go ahead and run “git add lisp/ChangeLog”. Otherwise, edit it further until satisfied, then run “git add lisp/ChangeLog”, at which point your working tree and index are in agreement (and “git diff” should produce no output).

The next thing you could try, is to run this command:

  git diff origin/master

This shows the difference between what is now in the working tree and what got fetched on your last I expect you will see all the changes you have made in your recent work, and nothing else. If so, go ahead and run “git commit“, but don't try to push yet. Your repository should now be in a sane state.

The only problem is that your latest additions – the ones you tried to commit with the initial C-x v v – will now be mixed in with the merge commit, which obscures the history. We might want to look into fixing that next.

– Harald



reply via email to

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