有人推了一个分行test
与git push origin test
共享仓库的共享仓库。git branch -r
如何查看遥控器test
我试过了
git checkout test
,它没有做任何事情git checkout origin/test
给给* (no branch)
有人推了一个分行test
与git push origin test
共享仓库的共享仓库。git branch -r
如何查看遥控器test
我试过了
git checkout test
,它没有做任何事情git checkout origin/test
给给* (no branch)
当前回答
命令
git fetch --all
git checkout -b <ur_new_local_branch_name> origin/<Remote_Branch_Name>
等于
git fetch --all
时和时
git checkout -b fixes_for_dev origin/development
两者将创造latest fixes_for_dev
调自development
其他回答
你基本上看到了树枝,但你还没有本地的拷贝!
你需要,你需要fetch
分支...
您可以简单地获取并退出分支, 使用下面的一条线命令来做到这一点 :
git fetch && git checkout test
我还创建了下面的图像 让你分享差异,看看如何fetch
以及它是如何与pull
:
如果远程分支名称是以特殊字符开头的,您需要在退出命令中使用单引号,否则Git将不知道您在谈论哪个分支。
例如,我试图查看一个远程分支 命名为#9773
,但如下图所示,命令没有正常工作:
出于某种原因,我想知道尖锐符号(###)是否与它有关,然后我试图用单引号绕绕分支名称,例如'#9773'
而不是仅仅#9773
幸运的是,它的工作很好。
git checkout -b '#9773' origin/'#9773'
我用了那个:
git clean -fxd # removes untracked (new added plus ignored files)
git fetch
git checkout {branchname}
git reset --hard origin/{branchname} # removes staged and working directory changes
简单运行git checkout
使用远程分支的名称。 Git 会自动自动创建本地分支, 跟踪远程分支 :
git fetch
git checkout test
但是,如果在不止一个远程中发现分支名称, 则无法使用 Git , 因为 Git 不知道该使用哪个 。 在这种情况下, 您也可以使用 :
git checkout --track origin/test
或
git checkout -b test origin/test
内2.19基特学会了checkout.defaultRemote
配置, 它指定了在解决此模糊性时默认的远程 。
从远程获取并检查分支。
git fetch <remote_name> && git checkout <branch_name>
例如:
git 获取来源 git 检出功能/ XYZ-1234- Add- 警告