Skip to main content

gwalk 是一系列用于管理 Git 仓库的命令行小工具,帮助开发者对大批量的 Git 仓库进行日常维护。

Project description

gwalk

gwalk 是一系列用于管理 Git 仓库的命令行小工具,帮助开发者对大批量的 Git 仓库进行日常维护。

安装

1. pip

  1. python -m pip install gwalk

2. build from source

  1. git clone https://github.com/ZeroKwok/gwalk.git
  2. cd gwalk
  3. python -m pip install .

使用

1. gl

gl.pygit pull 操作的快捷工具。

# 从远程仓库拉取代码并合并到当前分支, 等价于下面的命令 
# git pull {origin 或 第一个remotes} {当前分支}
gl

# git pull {origin 或 第一个remotes} {当前分支} --rebase
gl --rebase

2. gcp

gcp.py 是用于执行 git commitgit push 操作快捷工具。

# 添加未跟踪的文件以及已修改的文件,并提交到远程仓库, 等价于下面的命令 
# git add -u && git commit -m "fix some bugs" && git push
gcp "fix some bugs"

# 仅推送当前分支到所有远程仓库,不进行提交
gcp -p

3. gwalk

gwalk.pygwalk 工具的主要组件,提供了以下功能:

  • 列出目录下的所有 Git 仓库,支持过滤条件、黑名单、白名单和目录递归。
  • 显示列出的仓库的状态信息,支持输出信息的简短或冗长格式。
  • 在每个列出的仓库中执行一个操作。如运行自定义命令: 类似于子仓库操作 git submodule foreach 'some command' 但更加灵活。
# 列出当前目录下所有的'脏'的 Git 仓库
gwalk

# 递归列出当前目录下所有的 Git 仓库
gwalk -rf all

# 在列出的每个仓库中执行命令: git pull origin
gwalk -rf all -a "run git pull origin"

使用技巧

# 在所有 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

# 批量替换 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'))"`

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygwalk-0.2.1b0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygwalk-0.2.1b0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file pygwalk-0.2.1b0.tar.gz.

File metadata

  • Download URL: pygwalk-0.2.1b0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for pygwalk-0.2.1b0.tar.gz
Algorithm Hash digest
SHA256 c54d017e07fe22d122dd0e0caa871296e08af497387cb9b59caad12039fcb05b
MD5 14100ae8ecf724e6192cf3f0bd185631
BLAKE2b-256 714d8413aacb2b7c8838825bc83423fc3c6b2c01ab8b50287335061d5823e56b

See more details on using hashes here.

File details

Details for the file pygwalk-0.2.1b0-py3-none-any.whl.

File metadata

  • Download URL: pygwalk-0.2.1b0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for pygwalk-0.2.1b0-py3-none-any.whl
Algorithm Hash digest
SHA256 55c3d937b5f492b4db6f963d25d4aa0de07c2fef6c4d1cc61107e028c9bc8c27
MD5 f7aa04de859aa7919c4a884e1ac94d39
BLAKE2b-256 6a0751e6a469c528440693df3e9b0ccc846a4d162a2246ed9311f3848f223964

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page