gwalk 是一系列用于管理 Git 仓库的命令行小工具,帮助开发者对大批量的 Git 仓库进行日常维护。
Project description
gwalk
gwalk 一个用于管理批量 Git 仓库的命令行工具集,帮助开发者对大批量的 Git 仓库进行日常维护。
✨ 特性
- 🔍 列出指定目录下的 Git 仓库(可选递归)
- 🎯 支持按状态过滤(modified/untracked/dirty/clean)
- 📋 支持黑/白名单过滤
- 🚀 支持批量执行命令
- 🔄 集成常用 Git 操作的小工具
📦 安装
通过 pip 安装
python -m pip install pygwalk
从源码安装
git clone https://github.com/ZeroKwok/gwalk.git
cd gwalk
python -m pip install .
🔨 命令行工具
gl - Git Fetch & Pull
快速执行 fetch 和 pull 操作:
# 拉取所有远程仓库并合并到当前分支
gl
# 使用 rebase 模式拉取
gl --rebase
# 仅执行 pull (跳过 fetch)
gl -q
gcp - Git Commit & Push
快速提交并推送更改:
# 提交修改并推送到所有远程仓库, 等价于
# git add -u && git commit -m "your commit message" && git push
gcp "your commit message"
# 仅推送当前分支到所有远程仓库
gcp -p
gwalk - 仓库批处理工具
用于批量管理 Git 仓库:
# 列出当前目录下的所有 dirty 仓库
gwalk
# 递归列出当前目录下的所有仓库
gwalk -rf all
# 在所有列出的仓库中执行 git fetch && git pull
gwalk -rf all -a run gl
gapply - 补丁应用工具
应用补丁并创建提交(dry-run 模式):
gapply -n patchs/0008-Add-cache-and-Settings-management-capabilities-suppo.patch
输出如下:
Patch: patchs/0008-Add-cache-and-Settings-management-capabilities-suppo.patch
- subject : Add cache and Settings management capabilities, supportfor environment detection
- newfiles:
- src/shared/store/cache.js
- src/shared/store/preset.js
- src/shared/store/settings.js
- src/shared/utils/env.js
(dry-run) > git apply -v "patchs/0008-Add-cache-and-Settings-management-capabilities-suppo.patch"
(dry-run) > git add -u
(dry-run) > git add "src/shared/store/cache.js"
(dry-run) > git add "src/shared/store/preset.js"
(dry-run) > git add "src/shared/store/settings.js"
(dry-run) > git add "src/shared/utils/env.js"
(dry-run) > git commit -m "Add cache and Settings management capabilities, supportfor environment detection"
📝 使用示例
# 在所有 gwalk 列出的仓库中, 执行 gl 工具(git pull)
gwalk -rf all -a run gl
# 在所有 gwalk 列出的仓库中, 执行 git push 操作 {ab} 表示 当前分支(ActiveBranch)
gwalk -rf all -a run git push second {ab}
# 批量手动处理(交互模式)
# 在列出的所有 '包含未提交的修改' 的仓库中, 启动一个 bash shell 来接受用户的操作
gwalk -rf modified --a bash
# 批量推送
# 在列出的所有 '包含未提交的修改 且 不再黑名单中' 的仓库中, 运行 gcp 工具, 推送当前分支到所有远程仓库
gwalk -rf modified --blacklist gwalk.blacklist --a "gcp -p"
# 批量打标签
# 在列出的所有 白名单 gwalk.whitelist 匹配的仓库中, 运行 git tag v1.5.0
gwalk -rf all --whitelist gwalk.whitelist -a run git tag v1.5.0
# 批量查看目录下所有仓库的最近3次提交
gwalk -f all -l none -a run "git log --oneline -n3"
# 批量替换 origin 远程仓库的地址, 从 github.com 替换成 gitee.com
# 在所有 gwalk 列出的仓库中, 执行自定义命令
gwalk -rf all -a run git remote set-url origin `echo \`git remote get-url origin\` | python -c "print(input().replace('github.com', 'gitee.com'))"`
📄 协议
本项目基于 MIT 协议开源 - 详见 LICENSE 文件
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygwalk-0.3.1.tar.gz.
File metadata
- Download URL: pygwalk-0.3.1.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b268d3b3033e2c6af47c285d7e33e0317846430456a197177ca2634f482b93d4
|
|
| MD5 |
c85c249f154d1807bad3620b8e0a2a17
|
|
| BLAKE2b-256 |
1b76398816a7150fff0492128bc3ce68a96516d25a4d2b28ceb211d2375cbcad
|
Provenance
The following attestation bundles were made for pygwalk-0.3.1.tar.gz:
Publisher:
python-publish.yml on ZeroKwok/gwalk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygwalk-0.3.1.tar.gz -
Subject digest:
b268d3b3033e2c6af47c285d7e33e0317846430456a197177ca2634f482b93d4 - Sigstore transparency entry: 2136601481
- Sigstore integration time:
-
Permalink:
ZeroKwok/gwalk@20dadd656fd261d9ebdcfba3f2c818765cadca63 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/ZeroKwok
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@20dadd656fd261d9ebdcfba3f2c818765cadca63 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pygwalk-0.3.1-py3-none-any.whl.
File metadata
- Download URL: pygwalk-0.3.1-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71bd9bee30f5e3c5bcd9f8ac0ae3701c9cdff6b0d88b15bec48734272de26556
|
|
| MD5 |
ca7e663b115c2c5913d6a89c9ccffdf4
|
|
| BLAKE2b-256 |
1e38be894e1b29046f8e447d583b33e983fa8cd5227a7da1c01b77f90664a7a7
|
Provenance
The following attestation bundles were made for pygwalk-0.3.1-py3-none-any.whl:
Publisher:
python-publish.yml on ZeroKwok/gwalk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygwalk-0.3.1-py3-none-any.whl -
Subject digest:
71bd9bee30f5e3c5bcd9f8ac0ae3701c9cdff6b0d88b15bec48734272de26556 - Sigstore transparency entry: 2136601655
- Sigstore integration time:
-
Permalink:
ZeroKwok/gwalk@20dadd656fd261d9ebdcfba3f2c818765cadca63 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/ZeroKwok
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@20dadd656fd261d9ebdcfba3f2c818765cadca63 -
Trigger Event:
release
-
Statement type: