使用TFS Git分叉 [英] Forking using TFS Git

查看:154
本文介绍了使用TFS Git分叉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在使用TFS和Git的项目。我已经意识到我不能再分叉了,所以我想我会问你们你对这个解决方案的看法。



问题我得到的是我有一个基地项目。这将被我们每个客户重复使用。但每个客户都有一定程度的修改(约5-10%)。



我正计划将Fork项目A投入Client_A并进行所需的更改。
所有可以进行更改的类都是A中的Abstract类的实现,所以只要依赖关系得到满足,我就可以同步A的新版本。



现在我的问题是Forking不被支持,我们之前在我的团队中使用了bitbucket。但是,既然我们已经与公司的其他部分整合在一起,我们需要运行其他人正在运行的程序......

这就是我正在考虑的事情......

  git clone http://mycompany.com/tfs/MyDefaultCollection/我的Git项目/ _git / A 
cd A
git获取原点
git分支-a
git checkout -b a_branch1原点/ a_branch1
git checkout -b a_branch2原点/ a_branch2
git checkout -b a_branchN原点/ 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-来源
git push - 标签新来源
git远程rm来源
git远程重命名新来源来源

如果我这样做,我仍然能够上游到A?

解决方案

如果你删除了上游的远程设备( A ),它就无法工作。 可能你想要类似

 #1.在TFS中创建Client_A回购
#2.获取本地回购
git克隆http://mycompany.com/tfs/MyDefaultCollection/My Git项目/ _git / A
cd A
#3.重新定义远程
git远程重命名源上游
git远程添加源http://mycompany.com/tfs/MyDefaultCollection/My Git项目/ _git / Client_A
#4。推送给客户端A
git push origin
#5.推送到A(当适当时)
git push upstream

Git客户端无法在TFS中创建存储库,您需要通过Web界面手动执行或使用我的 TfsGitAdmin 实用程序。


$ b

更新:叉子功能可在VSTS或TFS 2018及更高版本中使用(请参阅 https:/ /docs.microsoft.com/en-us/vsts/git/concepts/forks )。


I'm in a project now that uses TFS and Git. And i've realized that i am not going to be able to Fork anymore so i thought i would ask you guys what you think about this as a solution.

The problem i am having is that i have a "Base" project.That would be reused for every client we have. But each client has modifications to some extent (about 5-10%).

I was planning to Fork project "A" into "Client_A" and make the changes needed. All the classes where changes can be made are implementations of Abstract classes in "A", so i would be able to sync a new version of A as long as dependencies are met.

My problem now is that Forking is not supported, we were using bitbucket before in my team. But since we were integrated with the rest of the company now we need to run what everyone else is running...

This is what i am thinking about doing...

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

If i do this will i still be able to upstream to A?

解决方案

If you remove the upstream remote (A), it cannot work.

Probably you want something like

# 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 client cannot create the repository in TFS, you need to do it manually via the Web interface or using my TfsGitAdmin utility.

UPDATE: The Fork feature is available in VSTS or TFS 2018 and later (see https://docs.microsoft.com/en-us/vsts/git/concepts/forks).

这篇关于使用TFS Git分叉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆