开发者

How can I delete a remote branch in a local git repository?

开发者 https://www.devze.com 2023-03-26 00:34 出处:网络
All the remote branches are visible as remotes in my local git reposi开发者_如何学运维tory after a git fetch.

All the remote branches are visible as remotes in my local git reposi开发者_如何学运维tory after a git fetch.

How to selectively remove the remote branches in my local repository (not in the remote repository)?


I had a slightly different but similar issue, but the solution might be useful to others who stumble on this question...

I noticed that my local repository still had remote branches that no longer existed on the remote, so I wanted to remove them. The solution is simply to fetch with the --prune (or -p) option:

git fetch --prune


git branch -r -d remote/branch

You also need to reconfigure fetch to avoid fetching this branch again later

0

精彩评论

暂无评论...
验证码 换一张
取 消