How do I delete old remote refs that are no longer valid

I have a few old pull requests that are no longer valid, but their refs are still hanging around.

git ls-remote 在这里输入图像描述

how do I go about removing these old refs on the remote?


You could, on the server itself, use git update-ref to delete these references. That method is more or less guaranteed to work—but requires that you be able to log in on the server itself.

The in-Git alternative, which may or may not be allowed by the server, is to send the server a push request of the form "delete ", using, eg:

git push --delete origin refs/pull-requests/70/from refs/pull-requests/70/merge

or equivalently:

git push origin :refs/pull-requests/70/from :refs/pull-requests/70/merge

The server might reject this request, saying that references in the refs/pull-requests namespace are reserved. If that's true, you're stuck with either:

  • log in on the server and use a Git command there, or
  • bypass Git entirely, perhaps by using a web interface.
  • It seems likely that the web interface (or similar) is the raison d'être for the use of that particular server in the first place: through their web interface, they provide features like "fork repository" and "make pull request".

    链接地址: http://www.djcxy.com/p/26016.html

    上一篇: Float.equals(几乎)完全无用,我应该用什么来代替?

    下一篇: 如何删除不再有效的旧远程参考