Git本地分支可供同事访问 [英] Git local branch accessible for coworker

查看:142
本文介绍了Git本地分支可供同事访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bob,Ben和Mike正在开展一个非常棒的项目。

Bob创建了一个名为foo的本地分支。
Bob将与Ben分享foo分支,所以Ben可以将其拉到并推送到它。
鲍勃不想让这个分支出现在迈克身上。
Bob不希望将此分支推送到原点。



这种情况下最简单的设置是什么?

解决方案

如果这些存储库位于开发人员本地计算机上,您可以: 让Bob的存储库可以被Ben读取(它可能已经默认)。然后Ben运行:

  git remote add bob bobsmachine.example.com:/path/to/bobs/repo/ursafile 
$ git fetch bob



Ben现在会有另一个名为bob的遥控器,例如origin具有。 Ben可以这样做: git pull bob branchname


Bob, Ben and Mike are working on an awesome project.

Bob has created a local branch named foo. Bob will share branch foo with Ben, so Ben can pull and push to it. Bob don't want show this branch to Mike. Bob don't want push this branch to origin.

What is the simplest setup for such scenario ?

解决方案

If these repositories are on the developers local machines, you can:

Give Ben ssh access on Bob's machine and make Bob's repository readable by Ben (it already might be by default). Then Ben runs:

git remote add bob bobsmachine.example.com:/path/to/bobs/repo/ursafile
git fetch bob

Ben will now have another remote named bob like "origin" that he probably already has. Ben can do things like: git pull bob branchname

这篇关于Git本地分支可供同事访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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