We have a repository, git-flow based, where we added an external library as a subtree (using Atlassian SourceTree's git subtree) on the development branch.
Project/
Library/
X/
Y/
Z/
Later we did a git flow release
, merging the changes from develop into master (release).
The problem is when checking out master, the contents of Library get placed on the root of the repository instead of inside Library, like it had lost the git subtree
prefix during the merge.
Project/
X/
Y/
Z/
Any idea what's gone wrong?
The subtree itself has its own root directory on its own branch. See http://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging, especially:
You want to pull the Rack project into your master project as a subdirectory. You can do that in Git with git read-tree. You’ll learn more about read-tree and its friends in Chapter 9, but for now know that it reads the root tree of one branch into your current staging area and working directory. You just switched back to your master branch, and you pull the rack branch into the rack subdirectory of your master branch of your main project:
$ git read-tree --prefix=rack/ -u rack_branch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With