开发者

Make git track data that is scattered across the disk

开发者 https://www.devze.com 2023-01-05 07:41 出处:网络
My project is set up so that I have source code and configuration files separate folders. For clarity, here is the basic folder structure:

My project is set up so that I have source code and configuration files separate folders.

For clarity, here is the basic folder structure:

C:\SourceCode
C:\ConfigFiles1
C:\ConfigFiles2
C:\ConfigFiles3

This causes a problem because I want to track all of these folders using Git. Git, on the other hand, seems to want every tracked file to be contained within a singl开发者_如何学编程e top-level folder.

If, for example, the .git folder is located in SourceCode (git init /c/SourceCode), it will refuse to add ConfigFiles1 (git add ../ConfigFiles1) because it is outside of the repository.

I would like to avoid creating a repository directly on C:\ (git init /c) if possible, because that just seems messy. Nevertheless, I'll take what I can get.

I am unable to move these configuration files to a more convenient location. I'm stuck with this folder structure.

FYI, in my case, I'm using Git on Windows (msysgit)


Are you able to put config files into SourceCode directory? If so, you may want to track Config files as git submodules in SourceCode dir.


If you don't want to move anything around, the best solution I can think of is a detached worktree. Create a bare Git repository in C:\ProjectTracker (or just about anywhere else) and set core.worktree = C:\; just remember to keep a large .gitignore file to ignore all the other files in C:\

0

精彩评论

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