简体   繁体   中英

Multiple git repo in one project

I'm using github as a repo for a little project, but I'd also like to use some code written by another github user.

Is it possible to setup a /library/libraryname folder inside my project which maintains it's links back to the other users repo as well as being part of my projects commits?

For example: If the other user updates their code later on, I'd like to be able to easily fetch their changes while still keeping it in the same repo as my main project.

I think you're probably looking for the git submodule command. Also have a look at the Git Submodule Tutorial .

If you want, you can use git subtree instead of git submodule. This is a little bit more convenient to use, and doesn't require people who checkout from your repository to know anything about submodules or subtrees. It also makes it easier to maintain your own patches to the subproject until you're ready to submit them upstream.

-- edit

Removed my claim that it's 'probably not possible'. Rest of my argument is still valid.

But anyway, generally, you don't want to get updates so fast like that. You'd prefer to have a 'stable' version of his library, and update it only when another 'stable' version is released (as tested by you; not neccessarily one considered 'stable' by him).

So even if you could (but in SVN, which I use, you can't, but I don't know about git specifically) you wouldn't want to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM