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

  • Git pretty format colors
  • Is there a way to run tests on a git branch while working on another one?
  • ssh_exchange_identification: Connection closed by remote host under Git bash
  • Can I use my existing git repo with openshift?
  • gerrit setup git repo — permission denied
  • Is there anyway to undo git push -f?
  • website/
       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?

  • git revert several specific commits
  • git destroyed my changes
  • Throwing away old history on git repo full of binaries
  • No .git repository folder showing, using windows 7
  • Git undo changes in some files
  • Git - finding the SHA1 of an individual file in the index
  • 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.