There is a branch on a third-party repo that I want to add as a subdirectory of my repo. I want to be able to make changes to this third-party code, maintain these changes in my repo and still receive updates made to the third-party repo. In essence, I'm trying to create an overlay.
Following the guide here to merge the subtree (which exactly describes what I'm trying to do), I created a remote item that points to this third-party repo, created a local branch that refers to the remote branch that I want, performed pulling on that branch and used read -tree for copying the contents of a local branch to a subdirectory in master.
I installed and clicked the changes (new files and changes to existing files) in this mastering subdirectory. Changes have also been made to various files in the upstream branch. I was able to make changes to my thread. However, when I try to merge as follows,
git merge --squash -s subtree --no-commit <my_branch>
My local changes are overwritten by upstream changes. The new files that I created are deleted, and the changes I made to existing files are lost.
Am I doing something wrong or is this the expected behavior? How can I save my changes and still merge the changes from the upstream?
source
share