git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Miklos Vajna <vmiklos@frugalware.org>
Cc: Richard Hartmann <richih.mailinglist@gmail.com>, git@vger.kernel.org
Subject: Re: commiting while the current version is in conflict
Date: Thu, 16 Oct 2008 16:00:35 -0700	[thread overview]
Message-ID: <20081016230035.GC9877@spearce.org> (raw)
In-Reply-To: <20081016224808.GO536@genesis.frugalware.org>

Miklos Vajna <vmiklos@frugalware.org> wrote:
> On Fri, Oct 17, 2008 at 12:10:55AM +0200, Richard Hartmann <richih.mailinglist@gmail.com> wrote:
> > all changes were submitted. Of course, I now have a
> > file with the conflict markers inlined in my repository. Not
> > a good thing, imo. Is there a way to make git block all
> > conflicting versions?
> 
> Write a pre-commit hook that checks for conflict markers?

The sample pre-commit hook checks for these.  Its really hande to
have enabled.
 
> > Also, I would be interested in the design decissions
> > behind the current behaviour. Any pointers?
> 
> Not sure, but in general blocking conflict markers by default would be a
> bad idea IMHO, several markup language (asciidoc, for example) makes use
> of the >>>, === and such character sequences.

Not only that, but "git commit -a" did exactly what you asked it to do:

	git add -u
	git commit

and git add -u is basically a faster way to do something like this pseudo-shell:

	for path in $(git status | grep modified:)
	do
		git add $path
	done

and merge conflicts are "resolved" by you running "git add $path"
after you have finished fixing that path.

Moral of the story is, don't use "git commit -a".  Use only "git commit"
and stage files individually.  That way when you are in a merge conflict
you won't be in the habit of writing "git commit -a" and staging everything
from the working tree implicitly.

-- 
Shawn.

  reply	other threads:[~2008-10-16 23:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-16 22:10 commiting while the current version is in conflict Richard Hartmann
2008-10-16 22:48 ` Miklos Vajna
2008-10-16 23:00   ` Shawn O. Pearce [this message]
2008-10-16 23:26     ` Richard Hartmann
2008-10-17  1:16       ` Avery Pennarun
2008-10-16 23:07   ` Richard Hartmann
2008-10-16 23:23     ` Shawn O. Pearce
2008-10-16 23:31       ` Richard Hartmann
2008-10-16 23:42 ` Jakub Narebski
2008-10-17  7:25   ` Richard Hartmann
  -- strict thread matches above, loose matches on Subject: below --
2008-10-16 23:39 Junio Hamano
2008-10-17  7:21 ` Richard Hartmann
2008-10-17  8:37   ` Junio C Hamano
2008-10-17  9:32     ` Richard Hartmann
2008-10-17  9:16   ` Jakub Narebski
2008-10-17  9:35     ` Richard Hartmann
2008-10-17  9:36     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081016230035.GC9877@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=richih.mailinglist@gmail.com \
    --cc=vmiklos@frugalware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).