2

我是 Git 的新手并开始学习它。我已经使用 SVN 很长时间了。我想模拟以下。

我在文件夹'main'中有一个主仓库。我可以在这个文件夹中拉取、提交和推送。我在“main”中有一个名为“srepo”的文件夹。我可以在此文件夹“srepo”中克隆一个子存储库

我在本地向 subrepo 'srepo' 添加了一些文件,并希望推送到上游 subrepo。当我执行命令 'git subrepo add FileName.txt' 然后它给我错误git-subrepo: 'add' is not a command。请参阅“git subrepo 帮助”。

当我执行命令“git subrepo commit”时,它给了我以下消息:-

git-subrepo: Command 'commit' requires arg 'subdir'.
  Usage: git subrepo commit <subdir> [<subrepo-ref>]
  Add subrepo branch to current history as a single commit.
  This command is generally used after a hand-merge. You have done a `subrepo
  branch` and merged (rebased) it with the upstream. This command takes the
  HEAD of that branch, puts its content into the subrepo subdir and adds a new
  commit for it to the top of your mainline history.

  This command requires that the upstream HEAD be in the `subrepo/<subdir>`
  branch history. That way the same branch can push upstream. Use the
  `--force` option to commit anyway.

  The `commit` command accepts the `--force` option.

使用提交命令添加子目录名称后,它显示“git-subrepo:无法提交:'subrepo/origin'不包含上游 HEAD。”

请让我知道如何解决这个问题。

同样的问题已发布在https://github.community/t5/How-to-use-Git-and-GitHub/Git-and-Git-Subrepo/mp/5974#M1955

4

0 回答 0