我现在在一个使用 TFS 和 Git 的项目中。我意识到我将无法再分叉了,所以我想我会问你们对此解决方案的看法。
我遇到的问题是我有一个“基础”项目。它将被我们拥有的每个客户重复使用。但每个客户都会有一定程度的修改(大约5-10%)。
我计划将项目“A”分叉到“Client_A”并进行所需的更改。
所有可以进行更改的类都是“A”中抽象类的实现,因此只要满足依赖关系,我就能够同步 A 的新版本。
我现在的问题是不支持 Forking,我们之前在我的团队中使用过 bitbucket。但由于我们与公司的其他部门整合在一起,现在我们需要运行其他人正在运行的内容......
这就是我正在考虑做的事情......
git clone http://mycompany.com/tfs/MyDefaultCollection/My Git Projects/_git/A
cd A
git fetch origin
git branch -a
git checkout -b a_branch1 origin/a_branch1
git checkout -b a_branch2 origin/a_branch2
git checkout -b a_branchN origin/a_branchN
git branch -a
git remote add new-origin http://mycompany.com/tfs/MyDefaultCollection/My Git Projects/_git/Client_A
git push --all new-origin
git push --tags new-origin
git remote rm origin
git remote rename new-origin origin
如果我这样做,我仍然能够上游到 A 吗?
如果您删除上游遥控器(A
),它无法工作。
也许你想要类似的东西
# 1. create Client_A repo in TFS
# 2. get A repo locally
git clone http://mycompany.com/tfs/MyDefaultCollection/My Git Projects/_git/A
cd A
# 3. redefine remotes
git remote rename origin upstream
git remote add origin http://mycompany.com/tfs/MyDefaultCollection/My Git Projects/_git/Client_A
# 4. push to Client A
git push origin
# 5. push to A (when proper)
git push upstream
Git 客户端无法在 TFS 中创建存储库,您需要通过 Web 界面或使用我的手动创建存储库TfsGitAdmin https://github.com/giuliov/TfsGitAdmin公用事业。
UPDATE:Fork 功能在 VSTS 或 TFS 2018 及更高版本中可用(请参阅https://learn.microsoft.com/en-us/vsts/git/concepts/forks https://learn.microsoft.com/en-us/vsts/git/concepts/forks).
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)