有人将称为 Git 推力源测试的分支推向共享仓库 。 我可以看到有 git 分支 -r 的分支 。 我如何查看远程测试分支 ? 我试过 :

git 检出测试, 它不会给 git 检出源/ 测试提供任何结果 * (无分支)


当前回答

因为某种原因,我不能做:

git checkout -b branch-name origin/branch-name

它扔出错误:

致命 : “ 来源/ 分支名称” 不是一个承诺, 无法从中创建分支“ 分支名称 ” 。

我不得不这样做:

git checkout -b branch-name commit-sha

其他回答

git 获取\ \ \ git 检查您的处名

git 分支 -r 表示对象名称无效, 因为该分支名称不在 Git 的本地分支列表中。 从源头更新您的本地分支列表 :

git remote update

然后尝试再检查一下你的远程分支。

这是为我工作。

我相信在所有偏远的树枝里都会拉拉, 这并不是最初的海报所希望的。

如果分支位于来源远程以外的某物上,我愿意做以下工作:

$ git fetch
$ git checkout -b second/next upstream/next

此选项将检查上游边远处的下一个分支, 到一个名为第二个/ 下一个的本地分支。 这意味着如果您已经拥有下一个命名为本地分支的分支, 就不会发生冲突 。

$ git branch -a
* second/next
  remotes/origin/next
  remotes/upstream/next

命令命令

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

两者将创建开发中的最新修正_for_ dev

i 使用了这一个:

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