简体   繁体   中英

How do I clean both remote and local git branches on windows

删除不再存在的分支引用并删除Windows命令提示符下已为git repos合并的本地分支的最佳方法是什么(即不使用bash)?

This will first remove any remote tracking references that no longer exist and then proceed to enumerate and remove already merged local branches. The exception is that current, develop and master branches will be kept.

git fetch -p && for /f "tokens=1,2" %b in ('git branch --merged ^| findstr /v /c:"master" /c:"develop" /c:"*"') do (git branch -d %b)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM