git_subtree

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_subtree [2017/11/07 02:50] – [Synopsis] rpjdaygit_subtree [2018/02/13 17:05] (current) – [Links] rpjday
Line 8: Line 8:
   * [[https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree|Atlassian --    * [[https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree|Atlassian -- 
 Git subtree: the alternative to Git submodule (2013)]] Git subtree: the alternative to Git submodule (2013)]]
-  * [[https://developer.atlassian.com/blog/2015/05/the-power-of-git-subtree/|The power of Git subtree (2015)]]+  * [[https://hpc.uni.lu/blog/2014/understanding-git-subtree/|Understanding Git subtree (2014)]] 
 +  * [[https://developer.atlassian.com/blog/2015/05/the-power-of-git-subtree/|Atlassian -- The power of Git subtree (2015)]]
   * [[https://medium.com/@porteneuve/mastering-git-subtrees-943d29a798ec|Mastering Git subtrees (2016)]]   * [[https://medium.com/@porteneuve/mastering-git-subtrees-943d29a798ec|Mastering Git subtrees (2016)]]
   * [[https://gist.github.com/kvnsmth/4688345|A real world usage for Git subtrees]]   * [[https://gist.github.com/kvnsmth/4688345|A real world usage for Git subtrees]]
Line 141: Line 142:
  
 ==== To manually update subtree ==== ==== To manually update subtree ====
 +
 +Synopsis:
 +
 +<code>
 +$ git subtree pull -P <prefix> <repository> <ref>
 +</code>
 +
 +Example:
  
 <code> <code>
Line 146: Line 155:
   --prefix .vim/bundle/tpope-vim-surround \   --prefix .vim/bundle/tpope-vim-surround \
   https://bitbucket.org/vim-plugins-mirror/vim-surround.git \   https://bitbucket.org/vim-plugins-mirror/vim-surround.git \
 +  master \
 +  --squash
 +$
 +</code>
 +
 +==== Add the subproject as a remote ====
 +
 +Add a remote (''-f'' means fetch immediately):
 +
 +<code>
 +$ git remote add \
 +  -f \
 +  tpope-vim-surround \
 +  https://bitbucket.org/vim-plugins-mirror/vim-surround.git
 +$
 +</code>
 +
 +Add the subtree:
 +
 +<code>
 +$ git subtree add \
 +  --prefix .vim/bundle/tpope-vim-surround \
 +  tpope-vim-surround \
 +  master \
 +  --squash
 +$
 +</code>
 +
 +To update at a later date:
 +
 +<code>
 +$ git fetch tpope-vim-surround master
 +$ git subtree pull \
 +  --prefix .vim/bundle/tpope-vim-surround \
 +  tpope-vim-surround \
   master \   master \
   --squash   --squash
 $ $
 </code> </code>
  • git_subtree.1510023052.txt.gz
  • Last modified: 2017/11/07 02:50
  • by rpjday