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

Re: Bogus error: Untracked working tree file '....' would be overwritten by merge. Aborting

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 17, 2010, 09:22 UTC
Message-ID
<AANLkTin3vbW7LFjJrS8yAyrWxVU=zorawAQAs8F1siSF@mail.gmail.com>
In-Reply-To
<AANLkTimp1ZvVLnRQa+LssbeO7F=9MrA56aZgFHQnbZCK@mail.gmail.com>
On Wed, Nov 17, 2010 at 09:37, demerphq <demerphq@gmail.com> wrote:
> Im hoping that if someone thinks that such a patch would be dismissed
> out of hand that they will let me know....

I don't think it should be dismissed, but it's interesting to look forward a bit and think how clever we really want to be.

E.g. if I have a tracked file "tracked" in my repository and do:
    echo Uncommited >>tracked &&
    git rebase -i HEAD~3
We'll error out with:
    tracked: needs update
    Working tree is dirty

Although we could be smarter and scan HEAD~3..HEAD and figure out that none of them changes "tracked" and go ahead with the rebase.

But arguably it would be more user friendly in the long term to lead users in the direction of always having clean working trees before they do operations like these. E.g. that users would turn your original example into:

    git status &&                      # reports no changes / modified files
    git tag before-reset-and-merge &&  # for ease of getting back / safe from gc
    git reset --hard HEAD^ &&          # no untracked files with --hard
    git merge some-branch              # clean merge

In which case the user would be accustomed to a workflow where he's guaranteed not to lose data, because Git is always tracking it.

But maybe we should just allow users to be more clever, and try really hard to find out if they can be clever without screwing up their working tree.

Previous: demerphqNext: Matthieu Moy
Message 6 of 8 in “Bogus error: Untracked working tree file '....' would be overwritten by merge. Aborting”
  1. demerphqNov 16, 2010
  2. demerphqNov 16, 2010
  3. Nguyen Thai Ngoc DuyNov 16, 2010
  4. Nguyen Thai Ngoc DuyNov 16, 2010
  5. demerphqNov 17, 2010
  6. Ævar Arnfjörð BjarmasonNov 17, 2010
  7. Matthieu MoyNov 17, 2010
  8. Nguyen Thai Ngoc DuyNov 17, 2010

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.