{"thread":{"id":"66207","subject":"Bug Report: subtree then rebase causes unrelated history to conflict","startedAt":"2026-08-22T16:10:12Z","lastAt":"2026-08-22T16:10:12Z","messageCount":1,"participants":["Gabriel Ford"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"551053","messageId":"DKVLQLCHHBM4.WCEIQ0I73YOA@fordltc.net","threadId":"66207","inReplyTo":null,"subject":"Bug Report: subtree then rebase causes unrelated history to conflict","fromName":"Gabriel Ford","fromEmail":"gabe@fordltc.net","sentAt":"2026-08-22T16:10:04Z","receivedAt":"2026-08-22T16:10:12Z","isPatch":false,"body":"I created this report from the git bugreport template following\nhttps://git-scm.com/community. Thanks to anyone who takes the time to\nread and look into this! Please let me know if there are any follow up\nquestions or if anything is unclear. This is my first bug report to git\nso please let me know if I should have written anything different!\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\n  I found this when using git subtree to vendor this library\n  (https://github.com/htfy96/dollar), I believe this will also happen in any\n  similar cases where the subtree has a file with an identical path as one of the\n  files in your repo.\n  \n  I was able to repro this from a brand new repository as follows:\n  \n  ```sh\n  mkdir ./test_repo \n  cd ./test_repo\n  touch .clang-format\n  echo 'Any text in this file should work' > .clang-format\n  git commit -m \"create .clang-format in main repo\"\n  \n  git checkout -b feat_branch\n  git subtree add --prefix dollar_subtree git@github.com:htfy96/dollar.git master --squash\n  \n  git checkout master\n  touch foo.txt\n  git commit -m \"commit anything so that we have something to rebase onto\"\n  \n  git checkout feat_branch\n  git rebase master\n  ```\n  \n  You should see that there is a conflict that needs resolution between the main\n  .clang-format file we created, and the subprojects .clang-format even though\n  the files are in seperate dirs.\n\n\nWhat did you expect to happen? (Expected behavior)\n  I did not expect a conflict since the .clang-format file we created didn't change.\n\n\nWhat happened instead? (Actual behavior)\n  There was a conflict between the two files in seperate dirs. \n\n\nWhat's different between what you expected and what actually happened?\n  The rebase conflict that occured.\n\n\nAnything else you want to add:\n  I think this is happening due to the way git subtree is squash merging in the\n  subproject, even though a git blame on the .clang-format we created doesn't\n  show any changes, it appears that the history conflicts since the path\n  relative to the root is the same in the subproject.\n\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.55.0\ncpu: x86_64\nbuilt from commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nrust: enabled\nfeature: fsmonitor--daemon\ngettext: enabled\nlibcurl: 8.21.0\nOpenSSL: OpenSSL 3.6.3 9 Jun 2026\nzlib-ng: 2.3.3\nSHA-1: SHA1_DC\nSHA-256: SHA256_BLK\ndefault-ref-format: files\ndefault-hash: sha1\nuname: Linux 7.1.8-arch1-3 #1 SMP PREEMPT_DYNAMIC Tue, 11 Aug 2026 09:16:08 +0000 x86_64\ncompiler info: gnuc: 16.1\nlibc info: glibc: 2.44\n$SHELL (typically, interactive shell): /usr/bin/fish\n\n\n[Enabled Hooks]\n\n"}]}