A week ago, I've reset a state of 'ceph-ansible' folder in %current% branch with code from corresponding branch (that tracks an upstream from github):
# git read-tree --prefix=ceph-ansible/ -u ceph_ansible
Then I've committed several changes, including:
Renamed file and commited:
# git mv site.yml.sample site.yml
Made some changes and committed
Pulled updates from original branch by:
# git merge -s subtree --squash ceph_ansible
It said:
Auto-merging ceph-ansible/site.yml.sample
blablabla
Squash commit -- not updating HEAD
Automatic merge went well; stopped before committing as requested
I can see that "my" ceph-ansible/site.yml is deleted (as well as few new files added by me), ceph-ansible/site.yml.sample is restored and doesn't contain my changes (it's just restored to the state before my changes).
git log ceph_ansible site.yml.sample
shows 26th of August, 2016 (= latest changes ceph-ansible branch), my changes in %current% branch was this October, so it shouldn't be any conflict either.
I believe there is some obvious explanation for this behavior. Could you help me please?
UPDATE: I've noticed that my git is quite old (1.8.3) and built it from source tarball (2.10.1). Now the output is:
# ~/gitbuild/git-2.10.1/git merge -s subtree --squash ceph_ansible
fatal: refusing to merge unrelated histories
A quick googling showed (Git refusing to merge unrelated histories ) that the default behavior is changed. Adding ' --allow-unrelated-histories' clears the error message but the merge itself is still wrong (my changes are lost).
This error message might explain why git can't merge it correctly (since these repos doesn't has any relations, right). Can somebody confirm this please? Doesn't "merge -s subtree" really merges branches?