[英]Can I do git checkout a branch from someone's local working repo?
假设有人在本地分支中提交了一些文件,但忘记了推送到远程仓库,而不是从远程仓库中进行git checkout分支名称,反正我们可以从他的本地仓库中签出分支吗?
Basically assuming that you were not prepared for this situation: You can`t 基本上假设您没有为这种情况做好准备:您不能
But you can prepare for this: 但是您可以为此做准备:
way 1 - with existing setup ssh on coworker machine 方式1-使用同事计算机上的现有安装ssh
git clone user@coworkerip:repo/path.git git clone user @ coworkerip:repo / path.git
way 2 - with existing setup of git daemon on coworker machine 方法2-在同事计算机上使用git守护程序的现有设置
git clone git://coworkerip/repo.git git克隆git://coworkerip/repo.git
way 3 方式3
... ...
From git-clone man 来自git-clone 男子
Git natively supports ssh, git, http, https, ftp, ftps, and rsync protocols Git本机支持ssh,git,http,https,ftp,ftps和rsync协议
So it really depends on what solution will fit your needs 因此,这实际上取决于哪种解决方案将满足您的需求
You can copy the repository from their machine to your machine, then do 您可以将存储库从他们的计算机复制到您的计算机,然后执行
git remote add temp /path/to/copy/of/their/repository
git checkout temp/branch-to-checkout
Alternatively you could share their repository using NFS or Windows filesharing or something like that, and mount that share and then do the same. 或者,您可以使用NFS或Windows文件共享或类似的方式共享其存储库,然后挂载该共享,然后执行相同的操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.