git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Allow adding files from git submodule to parent git repo if they are in .gitignore in the submodule

From
AKAlexey Murz Korepov <murznn@gmail.com>
Date
Dec 13, 2023, 11:07 UTC
Message-ID
<CAL5pyKseyxEfLbgEkDHSqWQVLGkrrcZU=BzRx2zZOaCdQbMaoA@mail.gmail.com>

Git submodules are pretty often used to "import" some external git repository into your git repository, to not manage its files in your git tree, that's good.

But very often we need to add some file to that submodule and manage it in our local git repository, and this file is usually in .gitignore in the submodule's git.

So, the example task is:

Copy a mysubmodule/config.example.yaml to mysubmodule/config.yaml (which is in .gitignore in the mysubmodule), make local changes, and store it in the local (parent) root git repo.

But the problem is that we can't add this mysubmodule/config.yaml file to our root git repository, because receiving an error: ``` $ git add -f mysubmodule/config.yaml fatal: Pathspec 'mysubmodule/config.yaml' is in submodule 'mysubmodule' ``` But I see no problems with doing this, if the file is in .gitignore of the mysubmodule submodule.

So, let's discuss the approach of how we can allow this in git?
Or will be glad to hear and discuss alternatives and workarounds for this task.
Next: Junio C Hamano
Message 1 of 2 in “Allow adding files from git submodule to parent git repo if they are in .gitignore in the submodule”
  1. Alexey Murz KorepovDec 13, 2023
  2. Junio C HamanoDec 13, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.