# merge --squash detects a nonexistent error

1 messages from 2012-11-14 to 2012-11-14. Participants: Angelo Borsotti.
Thread: https://gitlist.dev/t/32109

## Angelo Borsotti, 2012-11-14 07:26

Subject: merge --squash detects a nonexistent error
Message-ID: <CAB9Jk9ATdzQ5nSNDiKFMRMvyzKAOodC5n4Wan+AzSm_aDSLjRA@mail.gmail.com>
URL: https://gitlist.dev/e/CAB9Jk9ATdzQ5nSNDiKFMRMvyzKAOodC5n4Wan%2BAzSm_aDSLjRA%40mail.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

```
