开发者

How to maintain a Git repository that resides in another project directory?

开发者 https://www.devze.com 2023-01-19 03:27 出处:网络
I have a directory that looks like this: ProjectFolder/ + project_file + project_file_2 + project_folder/

I have a directory that looks like this:

ProjectFolder/
  + project_file

  + project_file_2

  + project_folder/
      + another_file

  * my_stuff/       <= add to repo
      * foo         <= add to repo
      * bar         <= add to repo

  * my_file         <= add to repo
  * my_other_file   <= add to repo

ProjectFolder is a piece of software that I did no write, nor is it a git repository. For what it's worth, it's vBulletin.

Inside the main folder, I have some project extensions/modules/etc. The location of these files is mandated by the outer project. Luckily, 95% of the files I care about stem from the ProjectFolder root. (Note the files marked with * above)

Is there a way I can easily add the *-marked files to a git repo?

The issue I see here is that git won't be able to distinguish my extensions from the outer project.

Extra: When updat开发者_如何学Going the outer project, it would be nice to simply reclone the git repo to reinstall all the extensions in my git repo.


Repo within a repo means generally submodule.

If you can make ProjectFolder a "parent repo" and each of your subdirectory a submodule, you would achieve the kind of organization you are after.

Each subrepo could be changed independently one from another.
Even if ProjectFolder is not a repository, nothing prevent you to make one in it (git init .), and you could add in it directly my_file and my_other_file, plus the reference to the other subdirectories declared as repo of their own.

0

精彩评论

暂无评论...
验证码 换一张
取 消