从Git Remotes清除分支

git-sweep的Python项目详细描述


Git扫描

一个命令行工具,帮助您清理已合并的git分支 变成主人。

git最好的特性之一是廉价的分支。现有分支 像GitHub Flow和文森特德里森的git-flow这样的模型描述 使用此功能的方法。

问题

您的master分支通常是所有代码所在的位置。所有功能 分支应该是短命的,一旦它们被合并到master中 完整的。

随着时间的推移,您可以建立一个长的分支列表,这些分支不是 需要更长时间。它们已经合并到master,我们如何处理它们 现在?

答案

使用git-sweep可以安全地删除 合并到master中

要安装它,请运行:

pip install git-sweep || easy_install git-sweep

自己试试(安全地)

要查看git sweep检测到的分支合并到主分支中的列表:

您需要将git存储库作为当前工作目录。

$ cd myrepo

preview命令不会对您的repo进行任何更改。

$ git-sweep preview
Fetching from the remote
These branches have been merged into master:

  branch1
  branch2
  branch3
  branch4
  branch5

To delete them, run again with `git-sweep cleanup`

如果您对列表满意,可以运行删除这些 远程分支,cleanup

$ git-sweep cleanup
Fetching from the remote
These branches have been merged into master:

  branch1
  branch2
  branch3
  branch4
  branch5

Delete these branches? (y/n) y
  deleting branch1 (done)
  deleting branch2 (done)
  deleting branch3 (done)
  deleting branch4 (done)
  deleting branch5 (done)

All done!

Tell everyone to run `git fetch --prune` to sync with this remote.
(you don't have to, yours is synced)

注意:这可能需要一点时间,它正在通过管道与遥控器通话。

您还可以为远程分支和主分支赋予不同的名称。

$ git-sweep preview --master=develop --origin=github
...

告诉它跳过默认情况下的git fetch

$ git-sweep preview --nofetch
These branches have been merged into master:

  branch1

To delete them, run again with `git-sweep cleanup --nofetch`

让它跳过某些分支。

$ git-sweep preview --skip=develop
Fetching from the remote
These branches have been merged into master:

  important-upgrade
  upgrade-libs
  derp-removal

To delete them, run again with `git-sweep cleanup --skip=develop`

一旦git sweep找到分支,就会要求您确认 删除它们。

Delete these branches? (y/n)

您可以使用--force选项绕过此选项并开始删除 立刻。

$ git-sweep cleanup --skip=develop --force
Fetching from the remote
These branches have been merged into master:

  important-upgrade
  upgrade-libs
  derp-removal

  deleting important-upgrade (done)
  deleting upgrade-libs (done)
  deleting derp-removal (done)

All done!

Tell everyone to run `git fetch --prune` to sync with this remote.
(you don't have to, yours is synced)

发展

git sweep使用git-flow来开发和释放cycles。如果你想的话 与我们一起破解这个问题,分叉项目并向 develop完成后分支。

要运行测试,引导构建并运行以下命令:

$ git clone http://github.com/arc90/git-sweep.git
$ cd git-sweep
$ python2.7 bootstrap.py
...
$ ./bin/buildout
...
$ ./bin/test

我们也使用Tox。它将运行Python2.6和2.7的测试。

$ ./bin/tox

要求

  • 吉特=1.7
  • python=2.6

许可证

友好邻里麻省理工执照。

新闻

0.1.1

发布日期:2012年3月28日

  • 修复问题1,使git扫描帮助菜单更有用
  • 在帮助中修复一个小语法问题
  • 修复问题2,它在告诉您使用 清理
  • 添加了一个–force选项以跳过确认提示

0.1.0

发布日期:不适用

  • 初始版本

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java利用Android的surfaceView   服务器不通过socket接受java中的客户端请求   带有文本标签和文本字段的用户界面java fx验证问题   java是否可以使用Wine在Linux上运行Eclipse Portable?   运行时的java意图参数   java不支持新的白俄罗斯卢布。util。通货   java Struts2文件上载NullPointerException   为什么PowerShell显示“找不到符号”错误,而VS代码Java进程控制台运行得很好?   创建意图的java空指针异常   ArrayList的java打印索引<String[]>   xpath java。伊奥。IOException:服务器返回了URL:http://www.w3.org/TR/html4/strict.dtd   java KeyListener未激活   java导入编译为jar的包:坏的类文件,类文件包含错误的类,包不存在错误   java将图像路径从onActivityResult传递到onClick函数   java Catch block不允许用户继续执行程序   java Spring Mvc不适用于除`/`