All of lore.kernel.org
 help / color / mirror / Atom feed
From: <rsbecker@nexbridge.com>
To: "'Loic Fouray'" <loic@yeplaa.net>
Cc: <git@vger.kernel.org>
Subject: RE: Merge conflict when lines next to each other are changed
Date: Wed, 1 Dec 2021 09:09:55 -0500	[thread overview]
Message-ID: <009301d7e6bd$227a0b30$676e2190$@nexbridge.com> (raw)
In-Reply-To: <8E09F910-1D70-4848-A9E3-FA94B60335D3@yeplaa.net>

On December 1, 2021 8:34 AM, Loic Fouray wrote:
> > Le 1 déc. 2021 à 13:19, rsbecker@nexbridge.com a écrit :
> >
> > On December 1, 2021 4:30 AM, Loic Fouray wrote:
> >> In a file, I have this 2 lines one below the other:
> >>
> >> Repository: myvalue
> >> Tag: 8.2.10
> >>
> >> On my local branch i have updated repository myvalue.
> >> On the upstream repo, they updated often the tag value (not updated
> >> of my side).
> >>
> >> When i perform a merge from upstream to local branch, i have a conflit.
> >> It seems that it’s related to neighboring lines.
> >> Could you confirm that it ‘s a normal git operation?
> >>
> >> Also, i need to automate this merge. Is It possible with git tools to
> >> avoid this conflict or to resolve this conflict automatically?
> >
> > I try to keep version-specific identifying information, which is already
> contained in git, out of my code. This includes change logs/history in each
> source file because git is good at keeping that information - it is redundant in
> the code. However, for organizations that need to do that, I suggest using
> clean/smudge filters so that the code inside the repository is clean, while
> things like the repo name and tag get injected into the code as git puts it into
> the working directory. The code is then cleaned up while being staged. This
> removes the possibility of the conflict on these lines by removing the
> differing lines. You can script this using a combination of sed and git
> commands. My own git front end does this all the time but it is not generally
> applicable to all platforms (only NonStop and MVS) so I have not contributed
> it.
> If i understand correctly, you use externals tools (sed ..) but there is no
> possibility to manage It directly by git (spécific options,merge strategy..) ,
> that’s right?

I avoid the merge problem by removing the lines that will cause conflicts from the source. You can use -Xtheirs to always choose the upstream, but I do not think that is going to give you the desired result in all cases. My suggestion is to avoid the problem. Yes, using an external tool for your clean/smudge filters is the suggestion if you must have the specific conflicting lines in your code.
-Randall




  reply	other threads:[~2021-12-01 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01  9:30 Merge conflict when lines next to each other are changed Loic Fouray
2021-12-01 12:18 ` rsbecker
2021-12-01 13:33   ` Loic Fouray
2021-12-01 14:09     ` rsbecker [this message]
2021-12-03 16:30   ` Loic Fouray
2021-12-03 16:52     ` rsbecker
2021-12-03  7:13 ` Jean-Noël Avila
2021-12-03 13:31   ` Loic Fouray

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='009301d7e6bd$227a0b30$676e2190$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=git@vger.kernel.org \
    --cc=loic@yeplaa.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.