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

merge --squash detects a nonexistent error

From
ABAngelo Borsotti <angelo.borsotti@gmail.com>
Date
Nov 14, 2012, 07:26 UTC
Message-ID
<CAB9Jk9ATdzQ5nSNDiKFMRMvyzKAOodC5n4Wan+AzSm_aDSLjRA@mail.gmail.com>
Hello,

I have got a case in which merge --squash issues an error that does not exist. I hope I am wrong, though. Consider the following example:

rm -rf public.git rm -rf private git init --bare public.git git clone public.git private cd private touch f1; git add f1; git commit -m A git checkout -b b1 touch f2; git add f2; git commit -m B git checkout master git checkout -b b2 touch f3; git add f3; git commit -m C git checkout master git checkout -b b3 touch f4; git add f4; git commit -m D

--- at this point we have
     A (f1)             master
      |--B (f1,f2)     b1
      |--C (f1,f3)     b2
      `--D (f1,f4)     *b3

git merge --squash b1 git merge --squash b2

The first merge adds f2 to the workspace, which then contains f1, f2 and f4. The second merge should add f3, and instead it complains:

error: Your local changes to the following files would be overwritten by merge:
        f2
Please, commit your changes or stash them before you can merge.
Aborting
Why should it overwrite f2, and with what?
-Angelo Borsotti
Message 1 of 1 in “merge --squash detects a nonexistent error”
  1. Angelo BorsottiNov 14, 2012

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.