Git using subtree or submodule to manage external resources

I read much about how awful the git submodule is supposed to be, but I am not sure if that is just the groaning of people who feel it limits or if it has serious issues (especially concerning my use case).

I just want to include different repos into my repo like this

  • Can I push hotfix to a tag in git
  • git merge branch in a zipper like fashion
  • Best Practice: How to handle code differences for iOS App when creating free and paid version?
  • How to set up SSH authenticated git commands in a TeamCity build step
  • git: squash/fixup earlier commit
  • Rails Tutorial localhost can't click “Account” button
  • website/
     libs/
      js/
       fs-slides [external]
       fs-dialog [external]
    

    and have to possibility to update those repos easily. As far as I understand there is no easy possibility of including just one file from a repo, right? (But that’s okay.)

    Should I use submodules for this?
    Or are there any problems with it? Or is subtree much easier?

  • Where does git store information about the origin of a repository
  • make sure files are converted CRLF into LF in an update hook- is there a performance hit?
  • setting up git/github on a mac: error on reading usr/local/etc/gitconfig
  • Git push to cPanel account - Push did not update modified file
  • What svn client does git-svn use?
  • How can I delete all local branches which would result in no changes if merged into master?
  • One Solution collect form web for “Git using subtree or submodule to manage external resources”

    Submodule is well-suited to your case, especially since you don’t mind included those subrepos in their own subdirectory.

    The main serious issue you could have using submodules is when updating them while having updates in progress, as described in “how exactly does git submodule work”:

    If you forget to set a branch when making commits in a submodules, said commits will be made on a detached HEAD, and those changes in progress will be lost at the next git submodule update (you can get them back through the reflog, if activated for your submodule repo).

    Then, as Michael comments, and as I detail in the link above, you need to push the submodule to its own upstream before commit and pushing the parent repo (to avoid pushing unpublish submodule commits)

    Git Baby is a git and github fan, let's start git clone.