开发者

Can I use git submodule to manage individual files as well as directories?

开发者 https://www.devze.com 2023-04-12 14:39 出处:网络
I have a complex repository where sometimes the logical boundaries between code segments crosses directory boundaries. Some开发者_开发技巧times a single file in directory X really needs to go with fil

I have a complex repository where sometimes the logical boundaries between code segments crosses directory boundaries. Some开发者_开发技巧times a single file in directory X really needs to go with files in directory Y.

E.g., pretend I have a central repo that looks like this:

a/foo
a/bar
b/baz1
b/baz2

...and I want my local repository to end up with a/* and b/baz1, but not b/baz2.

(Yes, the long term solution is to move the files, but while I am working on that refactoring, I need to version-control the files appropriately.)

Can I use git submodule to work on a set of code that includes some directories and some other random files? How would I do this?


No, the Git "submodule" feature is limited to subdirectories and all the files they contain.


Gists act as mini repositories and even include revision history. You can put your single files on gist.github.com and add them as submodules.

Even if hidden gists are public -- it's important to keep that in mind. Using gists may not be appropriate in all situations.

0

精彩评论

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

关注公众号