最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

git - What are these prefetch refs and how do I get rid of them? - Stack Overflow

programmeradmin0浏览0评论

I have been using gitk for years. Today I noticed that there are a bunch of new refs in my repo. See screenshot below.

The ref is prefetch/remotes/origin/<branch>, and there is one like this for every branch.

  1. What are these?
  2. Why are they only showing up now?
  3. How do I get rid of them?

I have been using gitk for years. Today I noticed that there are a bunch of new refs in my repo. See screenshot below.

The ref is prefetch/remotes/origin/<branch>, and there is one like this for every branch.

  1. What are these?
  2. Why are they only showing up now?
  3. How do I get rid of them?
Share Improve this question asked Mar 12 at 23:25 nullromonullromo 2,6914 gold badges24 silver badges51 bronze badges 8
  • According to grep -E "installed.*gitk" /var/log/dpkg.log, the last time gitk was touched was over 2 years ago, so it's not a recent gitk update that caused this. – nullromo Commented Mar 12 at 23:30
  • Prefetching behaviour in Git changed as of version 2.42 (Aug 2023) and depending on the specific repo, the new behaviour may apply and cause these refs. Possibly you recently updated your Git and that has caused the change? You could revert to an older version of Git, or have a look at the documentation and see under what condition this happens - your repo likely has a large number of remote branches, or is slow to fetch for a similar reason. – Grismar Commented Mar 12 at 23:34
  • I have git version 2.39.2 and it hasn't been updated since march 2023. – nullromo Commented Mar 12 at 23:36
  • ACTUALLY I did update the remote gitlab server recently, so that probably did it. That server now has git version 2.43.0. However, my coworkers (same OS, same building/LAN, same remote repo) do not have these prefetch refs, so that part confuses me. And is 23 branches a lot of branches? – nullromo Commented Mar 12 at 23:41
  • 1 I'm not sure what the cutoff is and whether that's the only metric that matters, but I've seen the same behavior on some projects and not on others for my own up to date GitLab server. By the way, it's technically not a problem - it improves performance, but I agree that it looks messy. – Grismar Commented Mar 13 at 3:07
 |  Show 3 more comments

1 Answer 1

Reset to default 0
  1. They are refs used internally by Git since version 2.42 that exist to optimize performance.

  2. Git was updated on the remote.

  3. Unsatisfying answer, but you can't.

发布评论

评论列表(0)

  1. 暂无评论