从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
发布日期:不适用