为什么它不是提交,而不能从中创建分支? [英] Why is it not a commit and a branch cannot be created from it?

查看:817
本文介绍了为什么它不是提交,而不能从中创建分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用复杂的存储库配置.我有五个:

I need to work with an intricate configuration of repositories. I have 5 of them:

  1. 机器1上的远程中央存储库.
  2. 我的笔记本计算机(计算机2)上的本地存储库.
  3. 机器3上的裸存储库.
  4. 计算机3上的存储库.
  5. 我们在机器4上进行代码审查的存储库.

因此,我的理解是这样的:

So, my understanding that it works this way:

  1. 在笔记本电脑(2号机)上,我从1号机上的中央存储库克隆/提取.
  2. 我将本地存储库推送到机器3(使用裸存储库作为中间").

现在,我在3号计算机上进行了一些更改,并将这些更改推送到4号计算机上.这是我需要遵循的说明:

Now I did some changes on the machine 3 and I want to push these changes to machine 4. Here are the instructions that I need to follow:

  1. 在计算机3上,所有工作都在测试分支中进行,提交.
  2. 在计算机3上推送您的裸仓库:git push origin test-branch
  3. 在笔记本电脑上:从machine-3存储库中获取新提交:git fetch machine3
  4. 从计算机3中检出分支:git checkout -b test-branch machine-3/test-branch
  5. 从机器4获取提交:git fetch origin
  6. git rebase原始服务器/主服务器
  7. git push origin HEAD:refs/for/master

我在执行步骤4时遇到问题.出现以下错误:

I have problems with step 4. I get the following error:

fatal: 'machine3/test-branch' is not a commit and a branch 'test-branch' cannot be created from it

添加

执行时

git rev-parse machine3/test-branch

在笔记本电脑(2号机)上,我得到:

On my laptop (machine 2) I get:

machine3/test-branch
fatal: ambiguous argument 'machine3/test-branch': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

推荐答案

问题很复杂/令人费解,答案很简单.别名和machine3之间不匹配.已使用的远程的别名不是machine3的.机器3还有另一个别名.

The question is complex / convolute, the answer is simple. There was a mismatch between the alias and machine3. The alias for the remote that has been used, was not for machine3. The machine3 had another alias.

这篇关于为什么它不是提交,而不能从中创建分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆