Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
branchclear-cli
Advanced tools
branchclear-cli 可以快速清理本地、远程、本地和远程已经合并到指定分支(默认为master
)的分支。
安装
npm i -D branchclear-cli
or yarn add branchclear-cli -D
初始化配置
npx branchclear-cli --init
初始化配置,也可使用npx branchclear-cli --init -y
跳过交互生成默认配置。
上述命令将会在项目根目录创建.branchclear.yml
文件
下面为npx branchclear-cli --init -y
创建的默认.branchclear.yml
文件
# 只删除正则匹配的分支 正则字符串 isReg必须为true才可设置
branchRegStr: ''
# 清除本地、远程、本地和远程分支 local 本地、remote 远程、all 本地和远程
clearPosition: local
# 忽略的分支正则 isIgnore必须为true才可设置
ignoreRegStr: ''
# 是否有忽略的分支
isIgnore: false
# 是否只删除匹配的分支
isReg: false
# 主分支的分支名
main: master
# 远程仓库名字
remoteName: origin
# 只删除当前帐号创建的分支
user: mengshang918
配合 husky,使用git-push 钩子在代码push
前自动删除已经合并到主分支的分支。
{
"husky": {
"hooks": {
"pre-push": "branchclear"
}
}
}
Usage: branchclear [options]
Options:
-V,--version 当前版本号
-y,--yes 所有选项使用默认值
--init 生成.branchclear.json配置文件
-m, --main <master> 主分支名称 (default: "master")
-u,--user <user> 只删除指定git用户创建的分支 (default: git config user.name)
-p,--position <local|remote|all> 删除类型 (default: "local")
-remote,--remotename <origin> 远程仓库名字 (default: "origin")
--branchreg <RegExp> 匹配的分支正则
--ignorereg <RegExp> 忽略的分支正则
-h, --help display help for command`
使用参数前必须先使用--init
创建.branchclear.yml
配置文件。
参数优先级高于配置文件优先级
当前所在分支不会被删除,主分支不会被删除。正则匹配的分支会(不会)被删除
FAQs
git分支清理cli工具
We found that branchclear-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.