git submoudle vs git subtree

git management subprojects

For some of the larger projects, in order to facilitate multiplexing, often need to extract subprojects. The UI project generally common, underlying logic common, shared third-party libraries do git management sub withdrawn. This time git provides two ways subproject management, submodule and subtree.

It was made for differences submodule and subtree of a summary: submodule IS Link; subtree IS Copy .

submodule

container and each module is independent of the git repo

submodule need to do a commit

Parent repo need to commitID sublayer also push up

submodule pit

  1. After submodule update and push, but did not push the main repo new meta file to the server, another developer after git pull submodule will stay in an unmodified version.

  2. Assuming everything is normal, the main repo are subject to change file date submodule, developers git submodule update submodule will not cut any branc large column  git git subtree submoudle VS H, so the default submodule of the repo will stay in a detached HEAD ( free state).

Modify the pit submodule

  1. Common practice to cut submodule directory, and then make changes, then commit and push.

  2. If you accidentally forget to switch to the branch, but also made a submission, you can save with cherry-pick command.

    1. The HEAD branch with git checkout to switch from a free state to the branch, this time, git will submit a report Warning say there is not on the branch, keep in mind this change-id submitted (if the change-id is aaaa)
    2. File with git cherry-pick aaaa and will be submitted to the branch just in.
    3. Submitted by git push updates to the remote database.

subtree

Only a git repo

Just do a commit

Reference Data - Tang Qiao's blog

Git Reference Example - Long Takami

Guess you like

Origin www.cnblogs.com/liuzhongrong/p/11986007.html
Git
Recommended