[英]Git best way to fork a submodule already in a repository
I have a git submodule (a vim plugin from github) which is already inside a git repository, and has been for 10 commits or so. 我有一个git子模块(来自github的vim插件) 已经存在于git存储库中,并且已经进行了10次提交。
I would now like to fork the submodule repo and make my own changes. 我现在想分叉子模块repo并进行自己的更改。
I think this will work ... but is it a bad way to do it? 我认为这会奏效......但是这样做是不好的方法吗?
.gitmodules
file in the main repo so it points to my forked repo on github .gitmodules
中编辑我的.gitmodules
文件,使其指向我在github上的分叉.gitmodules
git submodule sync
git submodule update
Or will this lose some git history tracking information / is there a better way? 或者这会丢失一些git历史跟踪信息/有更好的方法吗?
This is how you're supposed to do it (maybe except git submodule update
which in your case shouldn't do anything until you've done your own commits). 这就是你应该这样做的方式(可能除了
git submodule update
,在你的情况下,在你完成自己的提交之前不应该做任何事情)。 You'll just have to remember to fetch from time to time changes from upstream if you want to keep your module up to date. 如果您想让模块保持最新,您只需记住从上游不时获取更改。
To do this part, just go inside your submodule, add an upstream remote toward the upstream repository and fetch upstream. 要做这个部分,只需进入子模块,向上游存储库添加上游远程并获取上游。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.