Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用TFS-Git进行分叉_Git_Github_Tfs_Git Fork - Fatal编程技术网

使用TFS-Git进行分叉

使用TFS-Git进行分叉,git,github,tfs,git-fork,Git,Github,Tfs,Git Fork,我现在在一个使用TFS和Git的项目中。我已经意识到我再也不能用叉子了,所以我想我会问你们,你们觉得这个解决方案怎么样 我遇到的问题是我有一个“基本”项目,它将被我们所有的客户重用。但每个客户都有一定程度的修改(约5-10%) 我计划将项目“A”转换为“客户A”,并进行必要的更改。 所有可以进行更改的类都是“A”中抽象类的实现,因此只要满足依赖项,我就能够同步A的新版本 我现在的问题是不支持分叉,我们以前在团队中使用过bitbucket。但是,由于我们与公司的其他部门整合,现在我们需要像其他人一

我现在在一个使用TFS和Git的项目中。我已经意识到我再也不能用叉子了,所以我想我会问你们,你们觉得这个解决方案怎么样

我遇到的问题是我有一个“基本”项目,它将被我们所有的客户重用。但每个客户都有一定程度的修改(约5-10%)

我计划将项目“A”转换为“客户A”,并进行必要的更改。 所有可以进行更改的类都是“A”中抽象类的实现,因此只要满足依赖项,我就能够同步A的新版本

我现在的问题是不支持分叉,我们以前在团队中使用过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 client无法在TFS中创建存储库,您需要通过Web界面或使用my utility手动创建


更新:Fork功能在VSTS或TFS 2018及更高版本中可用(请参阅)。

您是否可以明确说明您想要实现的目标,而无需参考BitBucket,这可能是许多人不熟悉的?to Fork是GitHub和BitBucket采用的一个概念。它本身不是Git命令。我想做一些模拟fork过程的事情。那太棒了,这就是我所缺少的。你知道一种从fork(来源地)向上游回购提交PR的方法吗?有趣的问题。我还没有检查这在TFS中是如何工作的,但在GitHub中,只要您有适当的权限,您只需创建一个分支并将其推送到上游远程。啊,我想我没有考虑到这一点,因为我刚刚使用GitHub网站UI启动PR。谢谢。