1

I have a repository with a project, which contains several plugins. Plugins are added to the project as git submodules. Everything work okay, but the project may change some files in plugins while we work with it. Before we tracked those files inside submodules, but when we started to add plugins in different projects, this became a problem, as we often get conflicts with these changed files.

We decided to stop tracking these files in submodules, and instead track them in projects repos. But there is a problem. When I tried to track plugin files in main project, I got an error:

$ git add -f Plugins/**/Binaries/Win64/*.modules

fatal: Pathspec 'Plugins/AnalyticsTransport/Binaries/Win64/UE4Editor.modules' is in submodule 'Plugins/AnalyticsTransport'

Overall structure I want to achieve:

 /ProjectFolder
   file1.txt
   file2.txt
   /PluginSubmoduleFolder
     /pluginfile1.txt
     /pluginfile_dynam.txt # ignored file in submodule, which I want to track in Project repo

So, is it possible to achieve this in git? Is there any workaround, which will fix the error and start track files of submodules in main project?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • 2
    The short answer is just "no, you can't do that". Just keep the file in the superproject, not the submodule, if you want to keep the file in the superproject. – torek Apr 13 '21 at 20:42
  • @torek Thanks. But I'm not able to store it outside of submodule folder, as the software generates it and automatically places it there. There is a way with git hooks or custom scripts, but I thought there is a way to simply track them. – Alexander Blintsov Apr 13 '21 at 22:34
  • 1
    Depending on how annoying this software is, perhaps you can have the submodule contain a symbolic link, so that the generated file winds up in the superproject. If not, well, you'll have to resort to scripts or whatever. – torek Apr 13 '21 at 23:55

0 Answers0