gpt4 book ai didi

git子树缓存存在

转载 作者:行者123 更新时间:2023-12-04 14:52:54 27 4
gpt4 key购买 nike

我开始使用子树,但现在一团糟。谷歌搜索和手册页无济于事,我无法找到解决此错误的方法。有人有想法吗?

错误:

➜ git subtree split -P gitkraken --rejoin
cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!

外部重现它的示例。

mkdir test
cd test
git init
touch readme.md
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git add readme.md
git commit -m "add readme"
git subtree add --prefix gitkraken "aur@aur.archlinux.org:gitkraken.git" master
git subtree split -P "gitkraken" --rejoin

目前,在我的 repo 协议(protocol)中,我将文件夹切换到 gitkraken-aur ,所以它现在又可以工作了。

尝试从第一个答案开始删除子树文件夹。

test on  main [?]
➜ rm -rf .git/subtree-cache

test on  main [?]
➜ git subtree split -P "gitkraken" --rejoin

cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!

test on  main [?]
➜ git subtree pull -P gitkraken "aur@aur.archlinux.org:gitkraken.git" master -m "Merge subbtree gitkraken"
From aur.archlinux.org:gitkraken
* branch master -> FETCH_HEAD
Already up to date.

test on  main [?]
➜ git subtree push -P gitkraken "aur@aur.archlinux.org:gitkraken.git" master
git push using: aur@aur.archlinux.org:gitkraken.git master
cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!

test on  main [?]
➜ rm -rf .git/subtree-cache

test on  main [?]
➜ git subtree push -P gitkraken "aur@aur.archlinux.org:gitkraken.git" master
git push using: aur@aur.archlinux.org:gitkraken.git master
cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!

更多调试信息尝试一个。

test on  main [?]
➜ rm -rf .git/subtree-cache

test on  main [?]
➜ tree .git
.git
├── COMMIT_EDITMSG
├── FETCH_HEAD
├── HEAD
├── ORIG_HEAD
├── branches
├── config
├── description
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── fsmonitor-watchman.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── pre-merge-commit.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   ├── pre-receive.sample
│   ├── prepare-commit-msg.sample
│   ├── push-to-checkout.sample
│   └── update.sample
├── index
├── info
│   └── exclude
├── logs
│   ├── HEAD
│   └── refs
│   └── heads
│   └── main
├── objects
│   ├── 0c
│   │   └── ce20ac9c41edfaafd245059b066f4e644b6c84
│   ├── 23
│   │   └── 9ec593c6a2192e76c005435f748b2ad28be832
│   ├── 69
│   │   └── 3d7dd0cbe326ad51fffad7408c2c6cc8af7e0d
│   ├── 74
│   │   └── 11ec84b161eba98f6ae09d2210c231393c977c
│   ├── 84
│   │   └── a5dcf23e618a493da589f95f2c57da22603e2a
│   ├── 99
│   │   └── 03d6d6b962b96143f3e2c0b75550561de14c06
│   ├── b3
│   │   └── 5caa9cbb57f55fb05260b3dd767f92c62a20ba
│   ├── bf
│   │   └── 52649a7b94057b0da0a7f1bb20c55b395717be
│   ├── e4
│   │   └── 22b2b19b0c80773ccbad0822130158a024ef59
│   ├── e6
│   │   └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│   ├── eb
│   │   └── 4c7f2ebf6596f7e3c40b2355bc11e7a1badf58
│   ├── info
│   └── pack
│   ├── pack-542055b17c2fb18100e23d143d0f824b0c5ee19f.idx
│   └── pack-542055b17c2fb18100e23d143d0f824b0c5ee19f.pack
└── refs
├── heads
│   └── main
└── tags

23 directories, 37 files

test on  main [?]
➜ git subtree split -P "gitkraken" --rejoin

cache for 12d7b0ee9414ebd0414070d22fb40db7446badd9 already exists!

test on  main [?]
➜ tree .git
.git
├── COMMIT_EDITMSG
├── FETCH_HEAD
├── HEAD
├── ORIG_HEAD
├── branches
├── config
├── description
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── fsmonitor-watchman.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── pre-merge-commit.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   ├── pre-receive.sample
│   ├── prepare-commit-msg.sample
│   ├── push-to-checkout.sample
│   └── update.sample
├── index
├── info
│   └── exclude
├── logs
│   ├── HEAD
│   └── refs
│   └── heads
│   └── main
├── objects
│   ├── 0c
│   │   └── ce20ac9c41edfaafd245059b066f4e644b6c84
│   ├── 23
│   │   └── 9ec593c6a2192e76c005435f748b2ad28be832
│   ├── 69
│   │   └── 3d7dd0cbe326ad51fffad7408c2c6cc8af7e0d
│   ├── 74
│   │   └── 11ec84b161eba98f6ae09d2210c231393c977c
│   ├── 84
│   │   └── a5dcf23e618a493da589f95f2c57da22603e2a
│   ├── 99
│   │   └── 03d6d6b962b96143f3e2c0b75550561de14c06
│   ├── b3
│   │   └── 5caa9cbb57f55fb05260b3dd767f92c62a20ba
│   ├── bf
│   │   └── 52649a7b94057b0da0a7f1bb20c55b395717be
│   ├── e4
│   │   └── 22b2b19b0c80773ccbad0822130158a024ef59
│   ├── e6
│   │   └── 9de29bb2d1d6434b8b29ae775ad8c2e48c5391
│   ├── eb
│   │   └── 4c7f2ebf6596f7e3c40b2355bc11e7a1badf58
│   ├── info
│   └── pack
│   ├── pack-542055b17c2fb18100e23d143d0f824b0c5ee19f.idx
│   └── pack-542055b17c2fb18100e23d143d0f824b0c5ee19f.pack
├── refs
│   ├── heads
│   │   └── main
│   └── tags
└── subtree-cache
└── 24098
├── 12d7b0ee9414ebd0414070d22fb40db7446badd9
├── 9903d6d6b962b96143f3e2c0b75550561de14c06
├── e9aad069b8e1e49f8cbb54cb91e3f226e4949712
└── notree

26 directories, 40 files

最佳答案

您需要通过删除 .git/subtree-cache 文件夹来清除子树缓存。您始终可以尝试在该文件夹中搜索 12d7b0ee9414ebd0414070d22fb40db7446badd9 文件并删除它。

然后再次尝试执行您的命令。

我能够以这种方式重现和修复,通过对导致错误的代码进行逆向工程找到了答案:https://github.com/git/git/blob/master/contrib/subtree/git-subtree.sh#L329

关于git子树缓存存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68761778/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com