简体   繁体   English

git 从 master 切换存储库/分支

[英]git switching repository/branches from master

I'm not experienced with git.我对 git 没有经验。 I cloned a master branch of a project via git clone --link-- and now in my git bash window I see: /c/app/project (master) so I'm in the master.我通过git clone --link--克隆了一个项目的 master 分支,现在在我的 git bash 窗口中我看到: /c/app/project (master)所以我在 master 中。 Now I want to switch to an existing branch (say test) and do a pull to get the latest changes.现在我想切换到一个现有的分支(比如测试)并拉取以获取最新的更改。 When I type git checkout test I get error: "error: pathspec 'test' did not match any file(s) known to git. how can I switch the branch当我输入git checkout test我收到error: "error: pathspec 'test' did not match any file(s) known to git.我该如何切换分支

(since this was marked as duplicate, I checked the supposed answer and that did not solve my problem. It seems that I'm unable to move out of the master branch of my project) (由于这被标记为重复,我检查了假设的答案,但并没有解决我的问题。似乎我无法移出我的项目的主分支)

You should get familiar first with basic git.您应该首先熟悉基本的 git。 This is one of the possible resource which you can print and put beside your workstation.这是您可以打印并放在工作站旁边的可能资源之一。

Git cheat sheet Git备忘单

You can use您可以使用

git fetch if you want to just get remote branches git fetch如果你只想获取远程分支

or you can use或者你可以使用

git pull to sync the local with remote branches git pull同步本地与远程分支

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM