简体   繁体   English

我可以从某人的本地工作仓库中git checkout一个分支吗?

[英]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/r​​epo.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.

相关问题 我可以从本地 git 镜像克隆结帐分支吗 - Can I checkout branch from local git mirror clone 在 Git 中,我可以“签出”本地仓库中的所有远程分支吗? - In Git, can I “Checkout” all remote branches in my local repo? git-svn如何合并从本地git repo到其他远程svn分支的更改? - git-svn How can I merge changes from a local git repo to a different remote svn branch? Git:如何检查分支,忽略所有本地更改? - Git: How do I checkout a branch ignoring all local changes? 当我从有新文件的本地分支进行git fetch和git checkout origin / branch时,实际会发生什么? - What happens actually when I do git fetch and git checkout origin/branch from a local branch where new files are there? 理解使用本地仓库的“git checkout” - Understanding of "git checkout" working with local repo git checkout其他用户的本地仓库 - Git checkout another user's local repo 如何在具有指定分支和稀疏签出的巨大 git 回购协议中签出子目录? - How do I checkout a sub directory in a huge git repo with specified branch and with sparse checkout? git 从一个分支结帐到另一个分支删除了所有本地更改。 我怎样才能找回它们? - git checkout from one branch to another deleted all local changes. How can i retrieve them? 有人能告诉我如何让我的本地仓库上的主分支反映远程仓库上的主分支吗? - Can someone tell me how I can get the master branch on my local repo to reflect the master branch on the remote repo?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM