是否有最大数量的 git stash,或者您可以拥有任意数量的 git stash?
我知道
git stash list
没有列出尽可能多的结果
git stash list --date=local
但是,Linus Torvalds 是否认为任何拥有超过x 个存储的人都是白痴,应该失去旧的存储?
存储没有硬性限制。存储只是使用名为 的特殊命名 ref 的 reflog 实现的stash
。
不,没有限制。事实上,Git 非常优雅地处理大量存储:
$ du -sh .git; \
> for i in {1..10000}; do echo $i > README; git stash -q; done; \
> git gc -q; du -sh .git; time git stash list | wc -l
8.5M .git
13M .git # space efficient
10000 # all there
real 0m0.212s # listing 10,000 entries
$ echo foo > README; time git stash -q; time git stash pop -q
real 0m0.159s # save still fast
real 0m0.146s # pop still fast
我没有进行更多测试,但我认为它对于 100,000 或 100 万个仍然可以正常工作。所以是的,藏匿处的数量确实是无限的。