简体   繁体   English

git subtree split“没有找到新的修订版”

[英]git subtree split "No new revisions were found"

I've been using git subtree split to divide up one huge repository, imported to Git from another VCS, into smaller repositories.我一直在使用git subtree split将一个从另一个 VCS 导入 Git 的巨大存储库划分为较小的存储库。

$ git subtree split -P ./path/to/folder/ -b folder-only

This has been working and I've moved a couple of folders out into new repositories but attempts on their siblings, after running through all the available commits, have no branch created .这一直在工作,我已经将几个文件夹移到了新的存储库中,但是在运行所有可用提交之后,尝试在他们的兄弟姐妹上创建没有分支

The final message is最后的消息是

"No new revisions were found" “没有发现新的修订版”

I don't know if this is important or not but running with --debug gives messages like the following我不知道这是否重要,但使用--debug运行会给出如下消息

Processing commit: ca9d25944cf34bbe7aa356248a166ac1fb813f2a处理提交:ca9d25944cf34bbe7aa356248a166ac1fb813f2a
parents: fc0e5a621ab871b8a11071eec321f4b40b8dcce0父母: fc0e5a621ab871b8a11071eec321f4b40b8dcce0
newparents:新父母:
tree is:树是:

Why has git subtree split failed and what can I do about it?为什么git subtree split失败了,我该怎么办?

I had the same symptoms when my --prefix was pointing to a directory that was not known to git.当我的--prefix指向一个 git 不知道的目录时,我有同样的症状。 In my case I had a too aggressive .gitignore configuration.就我而言,我的.gitignore配置过于激进。

So, to clarify my suggestions.所以,澄清我的建议。

Make sure your:确保您的:

  1. --prefix folder is known to git. --prefix文件夹是 git 已知的。 If needed add and commit it first.如果需要,请先addcommit

  2. .gitignore file doesn't rule out your desired directory. .gitignore文件不排除您想要的目录。

I hope this helps, or at least gives you a hint in the right direction.我希望这会有所帮助,或者至少给你一个正确方向的提示。

At least on my Windows 10 environment, the directory you specify with the -P (--prefix) parameter in git subtree split is case sensitive .至少在我的 Windows 10 环境中,您在git subtree split使用 -P (--prefix) 参数指定的目录区分大小写 I was having the same problem as the OP until I tried the same command making sure to get the directory casing correct.在我尝试了相同的命令以确保目录大小写正确之前,我遇到了与 OP 相同的问题。

So if you're trying to split the Utility folder from c:\\repo\\Utility , you have to do git subtree split -P Utility ... , not git subtree split -P utility ...因此,如果您尝试从c:\\repo\\Utility拆分Utility文件夹,则必须执行git subtree split -P Utility ... ,而不是git subtree split -P utility ...

In my case, when I tried to connect a subfolder in one repo as a subtree folder in other repo, the problem was related that I just confused path prefixes.就我而言,当我尝试将一个 repo 中的子文件夹连接为其他 repo 中的子树文件夹时,问题与我只是混淆了路径前缀有关。 Namely, I tried to use the targer repo path prefix where I should have used the source path prefix and vice versa.也就是说,我尝试在我应该使用源路径前缀的地方使用 targer repo 路径前缀,反之亦然。

When I set path prefixes correctly, everything started to work correctly.当我正确设置路径前缀时,一切都开始正常工作。

More details.更多细节。 In a scenario like in this answer, part 3. git subtree.这个答案中的场景中,第 3 部分。 git subtree。 Merging the four files from contrib/completion/ of https://github.com/git/git.git into third_party/git_completion/ of the local repository.https://github.com/git/git.git 的contrib/completion/ 中的四个文件合并到本地仓库的third_party/git_completion/。 In code fragment:在代码片段中:

# Do this the first time:
$ git remote add -f -t master --no-tags gitgit https://github.com/git/git.git
$ git checkout gitgit/master
$ git subtree split -P contrib/completion -b temporary-split-branch
$ git checkout master
$ git subtree add --squash -P third_party/git-completion temporary-split-branch
$ git branch -D temporary-split-branch

accidentally, I just wrote contrib/completion in place of third_party/git-completion which was incorrect and lead to this error.偶然地,我只是写了contrib/completion代替了third_party/git-completion ,这是不正确的并导致了这个错误。 Placing prefixes to correct lines made it working like a charm.将前缀放在正确的行上使它像魅力一样工作。

Git subtree is apparently case sensitive in this way as well, this is on Windows 10 using Git 2.34.1: Git 子树显然也以这种方式区分大小写,这是在使用 Git 2.34.1 的 Windows 10 上:

I changed a single character in the folder name from lower case to upper case a while ago.不久前,我将文件夹名称中的单个字符从小写更改为大写。 Git subtree split resulted in the same message: "No new revisions were found". Git subtree split 产生相同的消息:“没有找到新的修订版”。

Temporarily changing back the case while subtree splitting solved it for me.在子树拆分的同时暂时改回情况为我解决了这个问题。

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

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