Fork a Github repo into another repo as part of a larger project

被刻印的时光 ゝ 提交于 2019-12-18 06:54:02

问题


Perhaps I'm missing something here, but I've looked and I want to do something that looks pretty simple, but I've yet to figure out (or find someone who has) how to accomplish it.

  • I have a project, and I've found a Github repo that contains content I would like to use as part of it.
  • I want to fork that repo's content into my project (another repo)
  • I want the connection of the fork to remain in case of changes to the original file (otherwise I would've simply simply copy/pasted at the beginning -- also, I would like the option of issuing pull-requests).

I've tried to simply, git clone https://github.com/dave/repository_of_dave.git (and variations) but then there is still a connection with all of the content from Dave's repo. Is copy/pasting the only way to go here?


回答1:


Submodules are indeed a good fit, as your repo will only record a gitlink (special entry mode 160000) to record the commit of the submodule repo you are using.

Don't forget that this submodule is a git repo of its own, which means:

  • you can make commits in it (see "true nature of submodules")
  • you can make it follow the latest commits of branch (see "git submodule update")
  • you can add remotes to it (like a remote to the original repo you have forked, in order to fetch updates from said original repo, see "What is the difference between origin and upstream in github")


来源:https://stackoverflow.com/questions/23002994/fork-a-github-repo-into-another-repo-as-part-of-a-larger-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!