{"thread":{"id":"42843","subject":"Bug report: 'git rebase' confusing files with initially equal content","startedAt":"2016-07-14T14:18:11Z","lastAt":"2016-07-14T14:18:11Z","messageCount":1,"participants":["Bernhard Graf"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"291416","messageId":"d105b779-7eb7-845f-d503-263846919c1a@augensalat.de","threadId":"42843","inReplyTo":null,"subject":"Bug report: 'git rebase' confusing files with initially equal content","fromName":"Bernhard Graf","fromEmail":"gitml@augensalat.de","sentAt":"2016-07-14T14:11:19Z","receivedAt":"2016-07-14T14:18:11Z","isPatch":false,"sender":{"key":"gitml@augensalat.de","avatar":null},"body":"With the following steps content from one file ends up in another file \nby using 'git rebase' (and clobbers the original content).\nIt is rather straight forward and I discovered this behaviour when \ntrying to replay http://gitforteams.com/resources/rebasing.html .\nThe special thing is, that both files have the same content at start.\n\n   $ mkdir rebase\n   $ cd rebase\n   git --version\n   git version 2.9.0\n   $ git init\n   Initialized empty Git repository in /home/graf/projects/git/rebase/.git/\n   $ echo stub >file1\n   $ echo stub >file2\n   $ git add .\n   $ git commit -m 'add stub'\n   [master (root-commit) 0cb53e9] Add stubs\n    2 files changed, 2 insertions(+)\n    create mode 100644 file1\n    create mode 100644 file2\n   $ git checkout -b feature/1\n   Switched to a new branch 'feature/1'\n   $ echo line1 >file1\n   $ git commit -am 'Add content'\n   [feature/1 2f3dcc7] Add content\n    1 file changed, 1 insertion(+), 1 deletion(-)\n   $ git checkout master\n   Switched to branch 'master'\n   $ git rm file1\n   rm 'file1'\n   $ git commit -m 'Delete file1'\n   [master 1b18590] Delete file1\n    1 file changed, 1 deletion(-)\n    delete mode 100644 file1\n   $ git checkout feature/1\n   Switched to branch 'feature/1'\n   $ echo line2 >>file1\n   $ git commit -am 'Add more content'\n   [feature/1 36be376] Add more content\n    1 file changed, 1 insertion(+)\n   $ cat file1\n   line1\n   line2\n   $ cat file2\n   stub\n   $ git rebase master\n   First, rewinding head to replay your work on top of it...\n   Applying  Add content\n   Using index info to reconstruct a base tree...\n   A\tfile1\n   Falling back to patching base and 3-way merge...\n   Auto-merging file2\n   Applying  Add more content\n   Using index info to reconstruct a base tree...\n   A\tfile1\n   Falling back to patching base and 3-way merge...\n   Auto-merging file2\n   $ ls -l\n   total 8\n   -rw-r--r--  1 graf  users  12 14 Jul 13:16 file2\n   $ cat file2\n   line1\n   line2\n\nIf instead file1 and file2 initially had different contents, 'git \nrebase' runs into a merge conflict, so the user can fix it appropriatly.\n\nI suppose this is related to the fact that Git manages the repo by file \ncontents only. Still this is nothing what I would expect (and neither \naccept).\n\n-- \nBernhard Graf\n"}]}