merge --squash strange error
- From
- Angelo Borsotti <angelo.borsotti@gmail.com>
- Date
- Oct 29, 2012, 13:37 UTC
- Message-ID
- <CAB9Jk9DSrvsOp8++q87y6oMVrTSNcKyoM_vKJyWih96y4tG+fg@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) *b3git 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.
AbortingWhy should it overwrite f2, and with what?
-Angelo