Bug Report: subtree then rebase causes unrelated history to conflict

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]




I created this report from the git bugreport template following
https://git-scm.com/community. Thanks to anyone who takes the time to
read and look into this! Please let me know if there are any follow up
questions or if anything is unclear. This is my first bug report to git
so please let me know if I should have written anything different!
What did you do before the bug happened? (Steps to reproduce your issue)
 I found this when using git subtree to vendor this library
 (https://github.com/htfy96/dollar), I believe this will also happen in any
 similar cases where the subtree has a file with an identical path as one of the
 files in your repo.
 
 I was able to repro this from a brand new repository as follows:
 
 ```sh
 mkdir ./test_repo 
 cd ./test_repo
 touch .clang-format
 echo 'Any text in this file should work' > .clang-format
 git commit -m "create .clang-format in main repo"
 
 git checkout -b feat_branch
 git subtree add --prefix dollar_subtree git@xxxxxxxxxx:htfy96/dollar.git master --squash
 
 git checkout master
 touch foo.txt
 git commit -m "commit anything so that we have something to rebase onto"
 
 git checkout feat_branch
 git rebase master
 ```
 
 You should see that there is a conflict that needs resolution between the main
 .clang-format file we created, and the subprojects .clang-format even though
 the files are in seperate dirs.
What did you expect to happen? (Expected behavior)
 I did not expect a conflict since the .clang-format file we created didn't change.
What happened instead? (Actual behavior)
 There was a conflict between the two files in seperate dirs. 
What's different between what you expected and what actually happened?
 The rebase conflict that occured.
Anything else you want to add:
 I think this is happening due to the way git subtree is squash merging in the
 subproject, even though a git blame on the .clang-format we created doesn't
 show any changes, it appears that the history conflicts since the path
 relative to the root is the same in the subproject.
Please review the rest of the bug report below.
You can delete any lines you don't wish to share.
[System Info]
git version:
git version 2.55.0
cpu: x86_64
built from commit: e9019fcafe0040228b8631c30f97ae1adb61bcdc
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
rust: enabled
feature: fsmonitor--daemon
gettext: enabled
libcurl: 8.21.0
OpenSSL: OpenSSL 3.6.3 9 Jun 2026
zlib-ng: 2.3.3
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1
uname: Linux 7.1.8-arch1-3 #1 SMP PREEMPT_DYNAMIC 2026年8月11日 09:16:08 +0000 x86_64
compiler info: gnuc: 16.1
libc info: glibc: 2.44
$SHELL (typically, interactive shell): /usr/bin/fish
[Enabled Hooks]

[Index of Archives] [Linux Kernel Development] [Gcc Help] [IETF Annouce] [DCCP] [Netdev] [Networking] [Security] [V4L] [Bugtraq] [Yosemite] [MIPS Linux] [ARM Linux] [Linux Security] [Linux RAID] [Linux SCSI] [Fedora Users]

(追記) (追記ここまで)
Powered by Linux

AltStyle によって変換されたページ (->オリジナル) /