git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Stephen Bannasch <stephen.bannasch@deanbrook.org>
Cc: git@vger.kernel.org
Subject: Re: can I always ignore a file during a merge?
Date: Tue, 3 Jul 2012 03:38:47 -0400	[thread overview]
Message-ID: <20120703073847.GD16679@sigill.intra.peff.net> (raw)
In-Reply-To: <p06240817cc114629c20f@[192.168.1.122]>

On Wed, Jun 27, 2012 at 07:39:03PM -0400, Stephen Bannasch wrote:

> Is there a way to merge from branchA to branchB and from branchB to
> branchA while completely ignoring changes to a file that is tracked
> and exists in both branches?

No. Fundamentally, a commit object in git consists of a content state
(i.e., a pointer to a tree object) and a pointer to all previous history
(i.e., zero or more "parent" pointers to commit objects). The semantics
of a commit object can be thought of as "I have looked at all of the
history in all of the parent commits, and the state contained in my tree
pointer supersedes them all".

So you could make merge B into A, but keep A's copy of the file (e.g.,
using the "ours" strategy). But that is saying that you considered the
state of both A and B, and decided that A's version supersedes what
happened in B. If you later wanted to merge from A to B, B's version of
the file would not even be considered as an outcome for the merge.

There isn't really a clever way to work around this via a different
merge strategy; it's a fundamental aspect of git's data structure for
storing history.

-Peff

  reply	other threads:[~2012-07-03  7:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 23:39 can I always ignore a file during a merge? Stephen Bannasch
2012-07-03  7:38 ` Jeff King [this message]
2012-07-05 19:49   ` Philip Oakley

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=20120703073847.GD16679@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=stephen.bannasch@deanbrook.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).