Providing custom files for git submodule

My project uses Varying-Vagrant-Vagrants as a submodule in /machine.

VVV offers the possibility to configure it through custom files. My custom files are:

  • Renaming git tags results in inconsistency
  • Jenkins + Git Publisher - How to push back to {GIT_BRANCH}?
  • Subgit: avoid to synchronize git branches onto svn
  • Why is git not pulling?
  • View diff of staged changes in git
  • git clone never completes
  • machine/
    ├── Customfile
    ├── config
    │   └── nginx-config
    │       └── sites
    │           └── mysite.conf
    └── www
        └── mysite
            ├── vvv-hosts
            ├── vvv-init.sh
            └── wp-cli.yml
    

    These paths are all ignored in VVV’s .gitignore file.

    What’s a good way of providing these files in my project so that they sit in the same directory as vvv when the whole project is recursively cloned? Hopefully without having to make a fork that tracks these files.

    Simply adding the submodule with these files present has the following result:

    $ git submodule add https://github.com/Varying-Vagrant-Vagrants/VVV.git machine/
    'machine' already exists and is not a valid git repo
    

    Thanks

  • Git: reset/revert a whole branch to another branches state?
  • Trying to use Git with Android Studio
  • how to find out list of all changed files in git for full jenkins build and not for a particular commit?
  • Disable warning about detached HEAD
  • Commit Changes to Git Configuration
  • ^M characters in git commit message (git commit -v)
  • One Solution collect form web for “Providing custom files for git submodule”

    From git help submodule,

    Submodules allow foreign repositories to be embedded within a dedicated
    subdirectory of the source tree, always pointed at a particular commit.

    Your invocation of git submodule add is complaining because you are trying to embed the foreign VVV repository in the subdirectory machine, which, as the message said, already exists and is not a valid git repo.

    To get your desired directory structure, with machine as a subdirectory of the VVV directory, you’d have to have your repo as a submodule of theirs, not the other way around.

    Given that, I don’t see how you could get a single git clone to pull both repos and organize them as you’d like. Next best might be to have your repo pull the VVV repo as a submodule/subdirectory parallel to your machine directory and include a script to establish a symlink to machine from inside the VVV subdirectory.

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