git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philip Oakley <philipoakley@iee.email>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andre Ulrich <andre.ulrich@smail.fh-koeln.de>, git@vger.kernel.org
Subject: Re: fast forward merge overwriting my code
Date: Mon, 24 May 2021 10:50:50 +0100	[thread overview]
Message-ID: <f3f8927f-75af-c3bd-07af-5fd4b64987e9@iee.email> (raw)
In-Reply-To: <xmqqo8d1o5ni.fsf@gitster.g>

On 23/05/2021 16:01, Junio C Hamano wrote:
> Philip Oakley <philipoakley@iee.email> writes:
>
>> On 22/05/2021 16:48, Andre Ulrich wrote:
>>> .... Then I use
>>>
>>> git checkout master
>>>
>>> and
>>>
>>> git merge testing
>>>
>>> I would expect git to tell me "hey, wait, you have changed some of the
>>> first lines in the .txt file. When you merge, your code on master will
>>> be altered". But git just merges everything in.
>> ...
>> maybe `git merge --no-ff testing` for use of a command line option
>>
>> or setup your .gitconfig e.g. `git config --global merge.ff no`,
>> but also `git config --global pull.ff yes` if you are using `git pull`
>> (=fetch + merge)
> I didn't get an impression that this has anything to do with
> fast-forwarding, though.  

Andre had (in the body of the text) explicitly said that it was the fast
forward that was the problem for him.

I suspect he had a mental model / world view / weltanshauung that was
more aligned to a swim lane model of branches (named lines of
development) and that, possibly in a GUI, the loss two lanes was rather
confusing.

> The file in question has changes on the
> "testing" branch since it forked from "master", and the user is
> merging, i.e. the user _assumes_ that the tip of each branch suits
> his/her purpose better than the tip of the other branch, hence wants
> to take improvements on both branches incorporated into a single
> history--- which is the point of "merging" the testing branch into
> the master branch.  

In his description it's not always clear "also change some of the
already existing lines" what happened elsewhere that could lead to the
confusion. It will have been tricky for Andre, as someone new to git, to
really know what was going on. We can't assume the new user knows what
Git will do.

> The result of merging might reveal that the tip
> of the other branch wasn't as great as s/he earlier thought, in
> which case s/he may want to undo the merge.  But if the result of
> merging better suites his/her purpose, it would be an improvement
> over where 'master' used to be (and it would also be an improvement
> over where 'testing' used to be), and the world makes a progress.
>
> In this particular case, the "master" side did not move since the
> two branches forked, so the merge was to take improvements made on
> "testing" into "master", and if the edit to the file in question
> made on "testing" were bogus, the merging operation of course will
> bring that breakage in, together with all the other changes.  Since
> the lack of any progress on the "master" side does not change this
> picture, I do not think fast-forwardness has anything to do with
> what Andre is complaining about.
>
> "git merge" cannot be expected to inspect the file and point out
> "no, the edit they made on the testing branch is totally bogus,
> don't merge it".  That is left for humans and tools other than Git
> (like test suite) may help them.
>
>
The changes to mental models that are needed to understand Git can take
some time, especially for those who haven't grown up with it.

Philip

  reply	other threads:[~2021-05-24  9:50 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22 15:48 fast forward merge overwriting my code Andre Ulrich
2021-05-22 17:12 ` Philip Oakley
2021-05-23 15:01   ` Junio C Hamano
2021-05-24  9:50     ` Philip Oakley [this message]
2021-05-23  9:48 ` Johannes Sixt
2021-05-23 23:58   ` brian m. carlson
2021-05-24  6:13     ` Andre Ulrich
2021-05-24 11:13       ` Bagas Sanjaya
2021-05-24 13:16       ` Philip Oakley
2021-05-24 15:06         ` Andre Ulrich
2021-05-24 18:48           ` Philip Oakley
2021-05-25 15:14             ` Philip Oakley
2021-05-30  5:31             ` David Aguilar
2021-05-30 11:00               ` Philip Oakley
2021-05-24 17:47       ` Igor Djordjevic
2021-05-26  2:53       ` Felipe Contreras
2021-05-26 11:06         ` Philip Oakley
2021-05-26 18:33           ` Felipe Contreras
2021-05-26 20:35             ` Philip Oakley
2021-05-26 23:34               ` Felipe Contreras
2021-05-27 12:05                 ` Philip Oakley
2021-05-27 14:00                   ` Felipe Contreras
2021-05-27 15:12                     ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=f3f8927f-75af-c3bd-07af-5fd4b64987e9@iee.email \
    --to=philipoakley@iee.email \
    --cc=andre.ulrich@smail.fh-koeln.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.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).