cromwell/git-spruce 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cromwell/git-spruce

最新稳定版本:0.2.0

Composer 安装命令:

composer require cromwell/git-spruce

包简介

CLI for sprucing up your local git, cleans out branches that have been merged upstream.

README 文档

README

CLI for sprucing up your local git, cleans out branches that have been merged upstream. Spruce is a tree, this tool cleans your branches. It is a pune or play on words.

usage

Description:
  Removes branches that have been merged to the configured merge base branch

Usage:
  [options]

Options:
  -p, --prune           Run a git fetch -p
  -f, --force           Runs git branch -D on detected branches.

Clone the repo to wherever you want, and add an alias:

$ alias 'git-spruce'='php /path/to/git-spruce/bin/git-spruce.php'

It runs contextual to the current working directory and prompts for each branch to potentially remove.

options

prune

The -p prune option runs get fetch -p.

This is important because otherwise you don't know what branches have been deleted upstream.

It's not enabled by default because it's slower as it contacts the remote.

force

By default, git-spruce runs git branch -d.

If you've not updated your local merge base yet, you may need the force delete option to remove branches that are in fact merged upstream.

config

A global default config file, config.yml, lives alongside the installation.

This contains the following keys:

  • ignore_branches: an array of branches to never remove. Defaults to develop, main and master.

  • merge_base: the merge base we're checking again to check what's merged. In a usual git flow workflow this will be develop. The default here is 'main'.

For the merge_base, 'main' and 'master' branches are treated as synonyms to handle the scenario where both conventions are in use.

You can override the config on a per repository basis by adding a .git-spruce.yml configuration file to each repo.

Perhaps you only merge to main on a particular repo, or some other branch. This is for that use case.

interactive

The deletion action is destructive, so it's interactive, prompting for confirmation for every deletion.

If you mess up you can probably recover a deleted branch from git reflog.

recovery

$ git-spruce 
Branch feature/foo is merged. Remove? y
Deleted branch feature/foo (was 19968853d).
$ git reflog | grep 19968853d
19968853d HEAD@{131}: commit: This is a test commit
$ git checkout 19968853d
Note: switching to '19968853d'.

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-06