git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: 'git pull' complains that a locally resurrected directory would be overwritten by merge when no pulled changes are affecting that directory

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 25, 2021, 21:19 UTC
Message-ID
<xmqqzgt5gr3g.fsf@gitster.g>
In-Reply-To
<CABPp-BEMXW3EOdT4jt1g63uPyZ5YuKUPfBE9BL=E66QcT5uXXA@mail.gmail.com>
Elijah Newren <newren@gmail.com> writes:
Show 11 quoted lines
> ... allow if the incoming changes don't touch the same files), but
> local *staged* changes.  As per the merge manpage:
>
> """
> To avoid recording unrelated changes in the merge commit, git pull and
> git merge will also abort if there are any changes registered in the
> index relative to the HEAD commit.
> """
>
> While this particular example could theoretically be handled by the
> merge machinery without requiring the index match HEAD,...

While I do not mind seeing a patch that loosens the condition ONLY when the merge will cleanly auto-resolve without end-user interaction, when any paths conflict and require editing by the end-user, it is pretty much essential to require that the index matches HEAD to keep "git merge" usable.

This is because the final step to conclude such an "automated procedure cannot cleanly resolve, so the end user helps resolving with the editor and mark the resolved paths with 'git add' or 'git rm'" session will become very error prone if we did not have the requirement. Not just the user MUST remember not to use "commit -a" or "git add" a path that was already dirty in the working tree before the merge started (which is the consequence of the current requirement, which allows local changes to the unrelated working tree files), they must MUST remember to somehow EXCLUDE the changes already registered for unrelted paths from the concluded merge.

Previous: Jeff KingNext: Jeff King
Message 5 of 9 in “'git pull' complains that a locally resurrected directory would be overwritten by merge when no pulled changes are affecting that directory”
  1. YuriAug 24, 2021
  2. Jeff KingAug 25, 2021
  3. Elijah NewrenAug 25, 2021
  4. Jeff KingAug 25, 2021
  5. Junio C HamanoAug 25, 2021
  6. Jeff KingAug 27, 2021
  7. Elijah NewrenAug 28, 2021
  8. Bagas SanjayaAug 25, 2021
  9. YuriAug 25, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.