git 如何清除git缓存?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31921561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to clear git caches?
提问by Carmine
When I list my branches with git branch -a
, git shows me remote branches I can't actually find on my remote(gitlab). I tried to checkout and track those branches, and to my big surprise, git did it. But when I do for example git push origin :branch_name
, git says that the remote ref does not exist, thus proving that I do not have those branches in my remote. Hence I have a question, are those branches stored in some kind a local cache? And if yes, how to clear it?
当我用 列出我的分支时git branch -a
,git 会显示我在我的远程(gitlab)上实际上找不到的远程分支。我试图检查和跟踪这些分支,令我惊讶的是,git 做到了。但是,例如git push origin :branch_name
,当我这样做时,git 说远程引用不存在,从而证明我的远程中没有这些分支。因此我有一个问题,这些分支是否存储在某种本地缓存中?如果是,如何清除它?
回答by mplf
Use git fetch -p
to prune your local caches
使用git fetch -p
修剪你的本地缓存
回答by Jan
Like mentioned on cleaning up old remote git branches, you should use git remote prune origin
.
就像在清理旧的远程 git 分支时提到的那样,您应该使用git remote prune origin
.
I didn't use the other two commands mentioned there.
我没有使用那里提到的其他两个命令。