unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* In git, how does one revert a single file with merge conflicts in it?
@ 2015-02-02 12:00 Alan Mackenzie
  2015-02-02 13:22 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alan Mackenzie @ 2015-02-02 12:00 UTC (permalink / raw)
  To: emacs-devel

Hello, Emacs.

I'm attempting to backport a bug fix from master to emacs-24, following
the procedure in .../admin/notes/git-workflow.

On doing
   $ git cherry-pick -xe <Commit Id>
, I get a half error message: "error: could not apply f3f7acc... ...".
Further investigation reveals that the cause is conflicts in a ChangeLog
file.  No surprises there.

So, how do I revert ChangeLog to get rid of the conflicts?  I've tried
   $ git checkout lisp/ChangeLog
, but this just gives the puzzling error message "error: path
'lisp/ChangeLog' is unmerged".  Isn't git great?

How do I revert a file in git?

TIA.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-02 12:00 In git, how does one revert a single file with merge conflicts in it? Alan Mackenzie
@ 2015-02-02 13:22 ` Andreas Schwab
  2015-02-02 19:29   ` Alan Mackenzie
  2015-02-02 16:05 ` Eli Zaretskii
  2015-02-02 17:40 ` Stefan Monnier
  2 siblings, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2015-02-02 13:22 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

Alan Mackenzie <acm@muc.de> writes:

> How do I revert a file in git?

Have you tried reading the manual?

git-checkout(1)

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-02 12:00 In git, how does one revert a single file with merge conflicts in it? Alan Mackenzie
  2015-02-02 13:22 ` Andreas Schwab
@ 2015-02-02 16:05 ` Eli Zaretskii
  2015-02-02 19:32   ` Alan Mackenzie
  2015-02-02 17:40 ` Stefan Monnier
  2 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2015-02-02 16:05 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Mon, 2 Feb 2015 12:00:03 +0000
> From: Alan Mackenzie <acm@muc.de>
> 
> On doing
>    $ git cherry-pick -xe <Commit Id>
> , I get a half error message: "error: could not apply f3f7acc... ...".
> Further investigation reveals that the cause is conflicts in a ChangeLog
> file.  No surprises there.

I suggest that you install the git-merge-changelog program and
configure it as the merge driver for ChangeLog files.  Then the
probability of such conflicts will be very close to zero.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-02 12:00 In git, how does one revert a single file with merge conflicts in it? Alan Mackenzie
  2015-02-02 13:22 ` Andreas Schwab
  2015-02-02 16:05 ` Eli Zaretskii
@ 2015-02-02 17:40 ` Stefan Monnier
  2015-02-02 19:37   ` Alan Mackenzie
  2 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2015-02-02 17:40 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

>    $ git cherry-pick -xe <Commit Id>
> , I get a half error message: "error: could not apply f3f7acc... ...".
> Further investigation reveals that the cause is conflicts in a ChangeLog
> file.  No surprises there.

IIUC git did perform the merge, you simply have a file with a conflict
as a result.  If you visit the file in Emacs, it should show you the
conflicts and if once you've edited the file so as too remove the
conflict markers, upon saving the result, Emacs should mark the file as
"resolved" (which you can do manually with "git add lisp/ChangeLog").


        Stefan



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-02 13:22 ` Andreas Schwab
@ 2015-02-02 19:29   ` Alan Mackenzie
  2015-02-03  9:04     ` Andreas Schwab
  2015-02-03 22:36     ` Steinar Bang
  0 siblings, 2 replies; 10+ messages in thread
From: Alan Mackenzie @ 2015-02-02 19:29 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: emacs-devel

Evening, Andreas.

On Mon, Feb 02, 2015 at 02:22:32PM +0100, Andreas Schwab wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > How do I revert a file in git?

> Have you tried reading the manual?

Many times, yes.  Not often with much success.

> git-checkout(1)

Not even this one.

> Andreas.

> -- 
> Andreas Schwab, SUSE Labs, schwab@suse.de

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-02 16:05 ` Eli Zaretskii
@ 2015-02-02 19:32   ` Alan Mackenzie
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Mackenzie @ 2015-02-02 19:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Hi, Eli.

On Mon, Feb 02, 2015 at 06:05:26PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 2 Feb 2015 12:00:03 +0000
> > From: Alan Mackenzie <acm@muc.de>

> > On doing
> >    $ git cherry-pick -xe <Commit Id>
> > , I get a half error message: "error: could not apply f3f7acc... ...".
> > Further investigation reveals that the cause is conflicts in a ChangeLog
> > file.  No surprises there.

> I suggest that you install the git-merge-changelog program and
> configure it as the merge driver for ChangeLog files.  Then the
> probability of such conflicts will be very close to zero.

Thanks, I didn't know about this program.  I'll see if I can get it
working in my git.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-02 17:40 ` Stefan Monnier
@ 2015-02-02 19:37   ` Alan Mackenzie
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Mackenzie @ 2015-02-02 19:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Hello, Stefan.

On Mon, Feb 02, 2015 at 12:40:04PM -0500, Stefan Monnier wrote:
> >    $ git cherry-pick -xe <Commit Id>
> > , I get a half error message: "error: could not apply f3f7acc... ...".
> > Further investigation reveals that the cause is conflicts in a ChangeLog
> > file.  No surprises there.

> IIUC git did perform the merge, you simply have a file with a conflict
> as a result.  If you visit the file in Emacs, it should show you the
> conflicts and if once you've edited the file so as too remove the
> conflict markers, upon saving the result, Emacs should mark the file as
> "resolved" (which you can do manually with "git add lisp/ChangeLog").

OK.  I think what confused me was me thinking that there shouldn't be
"another" ChangeLog entry for the backported patch, given that there's
already one for the original patch.  But the ChangeLogs in Emacs 24 are
not the same files as those in Emacs 25.  Hence there needs to be an
entry in both of them.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-02 19:29   ` Alan Mackenzie
@ 2015-02-03  9:04     ` Andreas Schwab
  2015-02-03  9:26       ` David Kastrup
  2015-02-03 22:36     ` Steinar Bang
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2015-02-03  9:04 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

Your case is explicitly and elaborately handled in the manual.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-03  9:04     ` Andreas Schwab
@ 2015-02-03  9:26       ` David Kastrup
  0 siblings, 0 replies; 10+ messages in thread
From: David Kastrup @ 2015-02-03  9:26 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Alan Mackenzie, emacs-devel

Andreas Schwab <schwab@suse.de> writes:

> Your case is explicitly and elaborately handled in the manual.

Man, time really flies.  It seems like the finals for "least helpful
answer on a mailing list" are coming up again.

How about replacing "the manual" with "somewhere"?  It's almost as
specific but more ominous.

> Andreas.

You don't say.

-- 
David Kastrup



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: In git, how does one revert a single file with merge conflicts in it?
  2015-02-02 19:29   ` Alan Mackenzie
  2015-02-03  9:04     ` Andreas Schwab
@ 2015-02-03 22:36     ` Steinar Bang
  1 sibling, 0 replies; 10+ messages in thread
From: Steinar Bang @ 2015-02-03 22:36 UTC (permalink / raw)
  To: emacs-devel

> On Mon, Feb 02, 2015 at 02:22:32PM +0100, Andreas Schwab wrote:
>> Alan Mackenzie <acm@muc.de> writes:

>> > How do I revert a file in git?

>> git-checkout(1)

git checkout sha1 path/to/file

In place of sha1 you could put a tag or a branch name.

















^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-02-03 22:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-02 12:00 In git, how does one revert a single file with merge conflicts in it? Alan Mackenzie
2015-02-02 13:22 ` Andreas Schwab
2015-02-02 19:29   ` Alan Mackenzie
2015-02-03  9:04     ` Andreas Schwab
2015-02-03  9:26       ` David Kastrup
2015-02-03 22:36     ` Steinar Bang
2015-02-02 16:05 ` Eli Zaretskii
2015-02-02 19:32   ` Alan Mackenzie
2015-02-02 17:40 ` Stefan Monnier
2015-02-02 19:37   ` Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).