Pergunta

so I have a few small files that I use in a lot of different projects. For example, I have a MySQL wrapper for PHP and a class for managing buffers in C++ among others. Up to now, I've been keeping them in one SVN repository. Then, when I'll use it in a project, I'll create a tag (pretty much just copying it to the tag folder in SVN), then I'll just hard link to that from my project. That way if I add, remove, or fix anything to the copy in the trunk, it won't affect the project.

This way, if I later want to switch the project to a newer version, it's as simple as checking the differences between the tagged version it uses the new version, updating some code in the project if necessary, and just changing the hard link.

However, I am now in the process of changing most of my code over to Git. I know Git has tags, but the folder only contains the trunk (the tags are stored in the version history, not a simple directory). Whats the best way to link to a specific tag of these files without having any later changes affect them? The only way I can think of is checking out a specific tag, and linking to that. However, this would require me to check it out for every project that is using a different version of it, and that just seems like more of a hassle than it should be.

Is there any easy way to do this?

Thanks.

Foi útil?

Solução

It seems that git-submodule is what you are looking for. Note however that the you will be tied up to a particular commit, not a tag (but that's good, you won't have to bother creating tags ;).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top