Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_subtree [2017/11/07 02:46] – [Example] rpjday | git_subtree [2018/02/13 17:05] (current) – [Links] rpjday | ||
|---|---|---|---|
| Line 8: | Line 8: | ||
| * [[https:// | * [[https:// | ||
| Git subtree: the alternative to Git submodule (2013)]] | Git subtree: the alternative to Git submodule (2013)]] | ||
| - | * [[https:// | + | |
| + | | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| Line 30: | Line 31: | ||
| ... snip ... | ... snip ... | ||
| + | |||
| + | DESCRIPTION | ||
| + | | ||
| + | | ||
| + | |||
| + | For example, you could include the source code for a library as a subdirectory of your | ||
| + | | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | do anything special or to understand how subtrees work. A subtree is just a subdirectory | ||
| + | that can be committed to, branched, and merged along with your project in any way you want. | ||
| + | |||
| + | ... snip... | ||
| OPTIONS | OPTIONS | ||
| Line 74: | Line 90: | ||
| === Start a subtree, and examine it === | === Start a subtree, and examine it === | ||
| + | |||
| + | The synopsis: | ||
| + | |||
| + | < | ||
| + | $ git subtree add -P < | ||
| + | </ | ||
| + | |||
| + | The example: | ||
| < | < | ||
| Line 117: | Line 141: | ||
| </ | </ | ||
| - | === To manually update subtree === | + | ==== To manually update subtree ==== |
| + | |||
| + | Synopsis: | ||
| + | |||
| + | < | ||
| + | $ git subtree pull -P < | ||
| + | </ | ||
| + | |||
| + | Example: | ||
| < | < | ||
| Line 123: | Line 155: | ||
| --prefix .vim/ | --prefix .vim/ | ||
| https:// | https:// | ||
| + | master \ | ||
| + | --squash | ||
| + | $ | ||
| + | </ | ||
| + | |||
| + | ==== Add the subproject as a remote ==== | ||
| + | |||
| + | Add a remote ('' | ||
| + | |||
| + | < | ||
| + | $ git remote add \ | ||
| + | -f \ | ||
| + | tpope-vim-surround \ | ||
| + | https:// | ||
| + | $ | ||
| + | </ | ||
| + | |||
| + | Add the subtree: | ||
| + | |||
| + | < | ||
| + | $ git subtree add \ | ||
| + | --prefix .vim/ | ||
| + | tpope-vim-surround \ | ||
| + | master \ | ||
| + | --squash | ||
| + | $ | ||
| + | </ | ||
| + | |||
| + | To update at a later date: | ||
| + | |||
| + | < | ||
| + | $ git fetch tpope-vim-surround master | ||
| + | $ git subtree pull \ | ||
| + | --prefix .vim/ | ||
| + | tpope-vim-surround \ | ||
| master \ | master \ | ||
| --squash | --squash | ||
| $ | $ | ||
| </ | </ | ||