Alex Feinman
Alex Feinman

Reputation: 5563

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

I have a complex repository where sometimes the logical boundaries between code segments crosses directory boundaries. Sometimes 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?

Upvotes: 4

Views: 1485

Answers (2)

IAmNaN
IAmNaN

Reputation: 10582

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.

Upvotes: 0

Greg Hewgill
Greg Hewgill

Reputation: 993025

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

Upvotes: 2

Related Questions