集体管理git项目
mgit的Python项目详细描述
概述
使用mgit,您可以一次拉取多个项目, 以及自动清理悬挂的分支(从过去的拉取请求)。
如果可能的话,将提供彩色输出,mgit通常应该可以用于:
- 快速了解N Git项目的概况
- 一次获取/拉取n个git对象
- 克隆丢失的项目(如果您倾向于在一个公用文件夹中从同一个远程克隆项目,则此功能非常有用)
示例用法
mgit可以显示文件夹中所有git项目的状态,例如my repos:
~/dev/github: mgit ~/dev/github: 4 github/zsimic mgit: [master] up to date pickley: [master] 1 diff, up to date* last fetch 3w 4d ago runez: [master] up to date* last fetch 3w 4d ago setupmeta: [master] up to date* last fetch 4d 23h ago
在这里我们可以看到我在~/dev/github中有4个repo(所有4个都来自github/zsimic), 他们中有三个已经有一段时间没被抓到了。 我们可以用--fetch(或-f)一次获取它们:
~/dev/github: mgit --fetch ~/dev/github: 4 github/zsimic mgit: [master] up to date pickley: [master] 1 diff, up to date runez: [master] up to date setupmeta: [master] up to date
现在所有的项目都更新了,我们可以看到没有什么新的 (否则我们会看到2 commits behind的形式)。 输出还显示其中一个项目有未提交的文件。
如果作用域中只有一个项目,则显示修改后的文件,例如:
~/dev/github: mgit pickley pickley: [master] 1 diff, up to date M tox.ini
在上面,我们可以看到问题中的修改文件是该项目中的tox.ini。 我们可以使用-verbose(或-v)标志获得相同的效果, 例如,有两个项目修改了文件:
~/dev/github: mgit -v ~/dev/github: 4 github/zsimic mgit: [master] 1 diff, up to date M README.rst pickley: [master] 1 diff, up to date M tox.ini runez: [master] up to date setupmeta: [master] up to date
概要:
~/dev/github: mgit --help Usage: mgit [OPTIONS] [TARGET] Manage git projects en masse Options: --version Show the version and exit. --debug Show debugging information --color / --no-color Use (or not) colors (on by default on tty) --ignore action[:what] Show/add/remove/clear ignores --clean [show|local|remote|all|reset] Auto-clean branches -a, --all Examine all repos, even missing git checkouts -f, --fetch Fetch from all remotes -p, --pull Pull from tracking remote, clone missing with --all -s, --short / -v, --verbose Short/verbose output -cs Handy shortcut for '--clean show' -cl Handy shortcut for '--clean local' -cr Handy shortcut for '--clean remote' -ca Handy shortcut for '--clean all' -h, --help Show this message and exit. Advanced usage: --clean show Show which local/remote branches can be cleaned --clean local Clean local branches that were deleted from their corresponding remote --clean remote Clean merged remote branches --clean all Clean local and merged remote branches --clean reset Do a git --reset --hard + clean -fdx (nuke all changes, get back to pristine state) --ignore show Show ignores currently in effect --ignore add 'hackday.*' Add an ignore regex, for example here 'hackday.*' --ignore remove 'hackday.*' Remove an ignore regex, for example here 'hackday.*' --ignore clean Remove all ignores
安装
pickley install mgit pipsi install mgit
您也可以从源代码编译:
git clone https://github.com/zsimic/mgit.git cd mgit tox -e venv source .venv/bin/activate