We are having an issue where the command:
git subtree pull --prefix=Root squash root master
is pulling code from the root repository into the . directory of our repository instead of the Root directory.
This command has worked fine in the past. The only difference is it has been a while since we have done a pull, so there are quite a few changes to merge.
I can't seem to find any official documentation on "git subtree", but there is a lot on the subtree merge strategy used with "git pull -s subtree". What is the difference (if any)?
Adding a subtreeSpecify the prefix local directory into which you want to pull the subtree. Specify the remote repository URL [of the subtree being pulled in] Specify the remote branch [of the subtree being pulled in] Specify you want to squash all the remote repository's [the subtree's] logs.
git subtree lets you nest one repository inside another as a sub-directory. It is one of several ways Git projects can manage project dependencies. Management of a simple workflow is easy. Older version of Git are supported (even older than v1.
The git pull command first runs git fetch which downloads content from the specified remote repository. Then a git merge is executed to merge the remote content refs and heads into a new local merge commit.
Splitting the Original Repository The subtree commands effectively take a folder and split to another repository. Everything you want in the subtree repo will need to be in the same folder.
git subtree
is an "alternative to submodules", see https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt or
https://medium.com/@porteneuve/mastering-git-subtrees-943d29a798ec
git pull -s subtree
or git merge -s subtree
selects the subtree merge strategy: http://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging
See also the answer to When to use git subtree?
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