2

Is it possible to have multiple Git Submodules to have the same name but with different path?

  • I want to have the same name because they do slightly different, but essentially the same thing.
  • I am able to recognize what does what, when I know the path of the submodules.

EDIT

Example:

    mkdir Temp
    cd Temp || exit
    git init
    git submodule add --force --name "Student" https://github.com/eirslett/test-git-repo.git "Student"
    mkdir Temp2
    cd Temp2 || exit
    git submodule add --force --name "Student" https://github.com/thockin/test.git "Student"

This only creates the following inside .gitmodules

[submodule "Student"]
    path = Temp2/Student
    url = https://github.com/thockin/test.git
Porcupine
  • 513

1 Answers1

0

The command git submodule adds a new folder directly in the path you run the command or is specified on the command. The folder is named with the same name as the repository being referenced.

This will create (if it doesn't already exist) a .gitmodules file referencing the local path that contains the remote repository's contents, as well as the URL for it. The .gitmodules file is placed in the current/specified folder.

There should be no problem with duplicate names, of course only if they are placed in different folders.

harrymc
  • 498,455