Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ reviewing, sharing, and applying changes locally.
- **Per-commit patches:** Keep the original patch content, commit messages, and
authorship, with numbered filenames in commit order.
- **Single commit:** Use `--commit <hash>` to download one commit's `.patch`
with either a short or full hash.
with either a short or full hash; the hash may also come first, as in
`<hash> --commit`.
- **GitLab support:** Pass `--gitlab` to fetch merge requests and commits from
gitlab.com, including projects nested under subgroups.
- **Tor support:** Pass `--tor` to download through the Tor network over a local
Expand Down Expand Up @@ -146,8 +147,11 @@ patchsplit <owner/repo> <pr-number> [--out <dir>] [--force] [--squash]
patchsplit <owner> <repo> <pr-number> [--out <dir>] [--force] [--squash]
patchsplit <owner/repo> --commit <hash> [--out <dir>] [--force]
patchsplit <owner> <repo> --commit <hash> [--out <dir>] [--force]
patchsplit <owner/repo> <hash> --commit [--out <dir>] [--force]
patchsplit <owner> <repo> <hash> --commit [--out <dir>] [--force]
patchsplit --gitlab <namespace/project> <mr-number> [--out <dir>] [--force] [--squash]
patchsplit --gitlab <namespace/project> --commit <hash> [--out <dir>] [--force]
patchsplit --gitlab <namespace/project> <hash> --commit [--out <dir>] [--force]
```

### Split a pull request by commit
Expand Down Expand Up @@ -213,11 +217,13 @@ the data GitHub includes in its diff; binary file contents may not be included.
### Download a single commit

Pass `--commit <hash>` (or `-commit <hash>`) with a short or full commit hash
instead of a pull request number:
instead of a pull request number. If you prefer the hash first, a bare
`--commit` after it works too:

```sh
patchsplit zitzhen patchsplit -commit b430113
patchsplit zitzhen/patchsplit --commit b4301133226e5c3a464cff9649de0b321c0b0a2e
patchsplit zitzhen patchsplit b430113 --commit
```

This fetches `https://github.com/<owner>/<repo>/commit/<hash>.patch` and writes
Expand Down
6 changes: 5 additions & 1 deletion README_zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ patchsplit <owner/repo> <pr-number> [--out <dir>] [--force] [--squash]
patchsplit <owner> <repo> <pr-number> [--out <dir>] [--force] [--squash]
patchsplit <owner/repo> --commit <hash> [--out <dir>] [--force]
patchsplit <owner> <repo> --commit <hash> [--out <dir>] [--force]
patchsplit <owner/repo> <hash> --commit [--out <dir>] [--force]
patchsplit <owner> <repo> <hash> --commit [--out <dir>] [--force]
patchsplit --gitlab <namespace/project> <mr-number> [--out <dir>] [--force] [--squash]
patchsplit --gitlab <namespace/project> --commit <hash> [--out <dir>] [--force]
patchsplit --gitlab <namespace/project> <hash> --commit [--out <dir>] [--force]
```

示例:
Expand Down Expand Up @@ -51,11 +54,12 @@ git apply pr-42-patches/pr-42.patch
### 下载单个 commit

不传 PR 编号,改用 `--commit <hash>`(也可写作 `-commit <hash>`)传入短哈希或
完整哈希:
完整哈希;如果习惯哈希在前,也可以把 `--commit` 写在后面:

```sh
patchsplit zitzhen patchsplit -commit b430113
patchsplit zitzhen/patchsplit --commit b4301133226e5c3a464cff9649de0b321c0b0a2e
patchsplit zitzhen patchsplit b430113 --commit
```

对应下载 `https://github.com/<owner>/<repo>/commit/<hash>.patch`,并把该 commit
Expand Down
45 changes: 45 additions & 0 deletions debian/patchsplit.1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@ patchsplit \- download GitHub pull request or GitLab merge request patches, spli
.RE
.br
.B patchsplit
.RI < owner/repo > " <hash> \-\-commit"
.RS
[\c
.B \-\-out
.IR dir ]
[\c
.B \-\-force ]
.RE
.br
.B patchsplit
.RI < owner > " <repo> <hash> \-\-commit"
.RS
[\c
.B \-\-out
.IR dir ]
[\c
.B \-\-force ]
.RE
.br
.B patchsplit
.B \-\-gitlab
.RI < namespace/project > " <mr-number>"
.RS
Expand All @@ -65,6 +85,17 @@ patchsplit \- download GitHub pull request or GitLab merge request patches, spli
[\c
.B \-\-force ]
.RE
.br
.B patchsplit
.B \-\-gitlab
.RI < namespace/project > " <hash> \-\-commit"
.RS
[\c
.B \-\-out
.IR dir ]
[\c
.B \-\-force ]
.RE
.SH DESCRIPTION
.B patchsplit
downloads the patch for a GitHub pull request and splits it into
Expand All @@ -85,6 +116,12 @@ download the patch of a single commit identified by a short or full hash and
write it verbatim to
.BR <hash>.patch .
The result is a mail-formatted patch for git am.
Without a value,
.B \-\-commit
acts as a mode flag and takes the hash from the last argument instead, so
.B patchsplit owner repo b430113 \-\-commit
is equivalent to
.BR "patchsplit owner repo \-\-commit b430113" .
.B \-\-commit
cannot be combined with
.BR \-\-squash .
Expand Down Expand Up @@ -158,6 +195,9 @@ requests always use https. Do not include a scheme or a path.
Download the .patch of a single commit instead of a pull request.
.I hash
may be a short or full commit hash.
Without a value, the flag selects commit mode and the hash is read from the
last argument, for example
.BR "patchsplit owner repo b430113 \-\-commit" .
The output file is named
.BR <hash>.patch .
Cannot be combined with
Expand Down Expand Up @@ -215,6 +255,11 @@ Download the patch for commit b430113 from
and write it to
.BR b430113.patch .
.TP
.B patchsplit zitzhen patchsplit b430113 \-\-commit
Download the same patch with the hash before the flag; a bare
.B \-\-commit
takes the last argument as the commit.
.TP
.B patchsplit \-\-gitlab zitzhen/patchsplit 1
Download and split merge request 1 from the GitLab project
.BR zitzhen/patchsplit .
Expand Down
45 changes: 45 additions & 0 deletions packaging/patchsplit.1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@ patchsplit \- download GitHub pull request or GitLab merge request patches, spli
.RE
.br
.B patchsplit
.RI < owner/repo > " <hash> \-\-commit"
.RS
[\c
.B \-\-out
.IR dir ]
[\c
.B \-\-force ]
.RE
.br
.B patchsplit
.RI < owner > " <repo> <hash> \-\-commit"
.RS
[\c
.B \-\-out
.IR dir ]
[\c
.B \-\-force ]
.RE
.br
.B patchsplit
.B \-\-gitlab
.RI < namespace/project > " <mr-number>"
.RS
Expand All @@ -65,6 +85,17 @@ patchsplit \- download GitHub pull request or GitLab merge request patches, spli
[\c
.B \-\-force ]
.RE
.br
.B patchsplit
.B \-\-gitlab
.RI < namespace/project > " <hash> \-\-commit"
.RS
[\c
.B \-\-out
.IR dir ]
[\c
.B \-\-force ]
.RE
.SH DESCRIPTION
.B patchsplit
downloads the patch for a GitHub pull request and splits it into
Expand All @@ -85,6 +116,12 @@ download the patch of a single commit identified by a short or full hash and
write it verbatim to
.BR <hash>.patch .
The result is a mail-formatted patch for git am.
Without a value,
.B \-\-commit
acts as a mode flag and takes the hash from the last argument instead, so
.B patchsplit owner repo b430113 \-\-commit
is equivalent to
.BR "patchsplit owner repo \-\-commit b430113" .
.B \-\-commit
cannot be combined with
.BR \-\-squash .
Expand Down Expand Up @@ -158,6 +195,9 @@ requests always use https. Do not include a scheme or a path.
Download the .patch of a single commit instead of a pull request.
.I hash
may be a short or full commit hash.
Without a value, the flag selects commit mode and the hash is read from the
last argument, for example
.BR "patchsplit owner repo b430113 \-\-commit" .
The output file is named
.BR <hash>.patch .
Cannot be combined with
Expand Down Expand Up @@ -215,6 +255,11 @@ Download the patch for commit b430113 from
and write it to
.BR b430113.patch .
.TP
.B patchsplit zitzhen patchsplit b430113 \-\-commit
Download the same patch with the hash before the flag; a bare
.B \-\-commit
takes the last argument as the commit.
.TP
.B patchsplit \-\-gitlab zitzhen/patchsplit 1
Download and split merge request 1 from the GitLab project
.BR zitzhen/patchsplit .
Expand Down
11 changes: 8 additions & 3 deletions po/patchsplit.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: patchsplit 1.4.0\n"
"Project-Id-Version: patchsplit 1.5.0\n"
"Report-Msgid-Bugs-To: https://github.com/zitzhen/patchsplit/issues\n"
"POT-Creation-Date: 2026-11-06 20:21+0800\n"
"POT-Creation-Date: 2026-11-21 22:27+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -175,10 +175,14 @@ msgid ""
" patchsplit <owner> <repo> <pr-number> [--out <dir>] [--force] [--squash]\n"
" patchsplit <owner/repo> --commit <hash> [--out <dir>] [--force]\n"
" patchsplit <owner> <repo> --commit <hash> [--out <dir>] [--force]\n"
" patchsplit <owner/repo> <hash> --commit [--out <dir>] [--force]\n"
" patchsplit <owner> <repo> <hash> --commit [--out <dir>] [--force]\n"
" patchsplit --gitlab <namespace/project> <mr-number> [--out <dir>] [--"
"force] [--squash]\n"
" patchsplit --gitlab <namespace/project> --commit <hash> [--out <dir>] [--"
"force]\n"
" patchsplit --gitlab <namespace/project> <hash> --commit [--out <dir>] [--"
"force]\n"
"\n"
"Options:\n"
" -o, --out <dir> Output directory for patch files [default: patches]\n"
Expand All @@ -188,7 +192,8 @@ msgid ""
" --gitlab Download from gitlab.com (merge requests and commits)\n"
" --host <host> Use a custom host, e.g. GitHub Enterprise or self-hosted "
"GitLab\n"
" --commit <hash> Download one commit's .patch (short or full hash)\n"
" --commit <hash> Download one commit's .patch (short or full hash);\n"
" the hash may also be given before the flag\n"
" --tor[=<host:port>] Download through the Tor network over SOCKS5\n"
" [default: 127.0.0.1:9050]\n"
" -h, --help Show this help\n"
Expand Down
16 changes: 13 additions & 3 deletions po/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: patchsplit 0.1.0\n"
"Report-Msgid-Bugs-To: https://github.com/zitzhen/patchsplit/issues\n"
"POT-Creation-Date: 2026-10-07 14:32+0800\n"
"POT-Creation-Date: 2026-11-21 22:27+0800\n"
"PO-Revision-Date: 2026-08-10 19:11+0800\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
Expand Down Expand Up @@ -180,10 +180,14 @@ msgid ""
" patchsplit <owner> <repo> <pr-number> [--out <dir>] [--force] [--squash]\n"
" patchsplit <owner/repo> --commit <hash> [--out <dir>] [--force]\n"
" patchsplit <owner> <repo> --commit <hash> [--out <dir>] [--force]\n"
" patchsplit <owner/repo> <hash> --commit [--out <dir>] [--force]\n"
" patchsplit <owner> <repo> <hash> --commit [--out <dir>] [--force]\n"
" patchsplit --gitlab <namespace/project> <mr-number> [--out <dir>] [--"
"force] [--squash]\n"
" patchsplit --gitlab <namespace/project> --commit <hash> [--out <dir>] [--"
"force]\n"
" patchsplit --gitlab <namespace/project> <hash> --commit [--out <dir>] [--"
"force]\n"
"\n"
"Options:\n"
" -o, --out <dir> Output directory for patch files [default: patches]\n"
Expand All @@ -193,7 +197,8 @@ msgid ""
" --gitlab Download from gitlab.com (merge requests and commits)\n"
" --host <host> Use a custom host, e.g. GitHub Enterprise or self-hosted "
"GitLab\n"
" --commit <hash> Download one commit's .patch (short or full hash)\n"
" --commit <hash> Download one commit's .patch (short or full hash);\n"
" the hash may also be given before the flag\n"
" --tor[=<host:port>] Download through the Tor network over SOCKS5\n"
" [default: 127.0.0.1:9050]\n"
" -h, --help Show this help\n"
Expand All @@ -213,18 +218,23 @@ msgstr ""
" patchsplit <owner> <repo> <pr-number> [--out <dir>] [--force] [--squash]\n"
" patchsplit <owner/repo> --commit <hash> [--out <dir>] [--force]\n"
" patchsplit <owner> <repo> --commit <hash> [--out <dir>] [--force]\n"
" patchsplit <owner/repo> <hash> --commit [--out <dir>] [--force]\n"
" patchsplit <owner> <repo> <hash> --commit [--out <dir>] [--force]\n"
" patchsplit --gitlab <namespace/project> <mr-number> [--out <dir>] [--"
"force] [--squash]\n"
" patchsplit --gitlab <namespace/project> --commit <hash> [--out <dir>] [--"
"force]\n"
" patchsplit --gitlab <namespace/project> <hash> --commit [--out <dir>] [--"
"force]\n"
"\n"
"选项:\n"
" -o, --out <dir> patch 文件输出目录 [默认:patches]\n"
" -f, --force 覆盖已有 patch 文件\n"
" -s, --squash 将净变化输出为一个补丁,而不是按 commit 拆分\n"
" --gitlab 从 gitlab.com 下载(合并请求和 commit)\n"
" --host <host> 使用自定义主机名,例如 GitHub Enterprise 或自建 GitLab\n"
" --commit <hash> 下载单个提交的 .patch(短哈希或完整哈希)\n"
" --commit <hash> 下载单个提交的 .patch(短哈希或完整哈希),\n"
" 哈希也可以写在 --commit 之前\n"
" --tor[=<host:port>] 通过 SOCKS5 经 Tor 网络下载\n"
" [默认:127.0.0.1:9050]\n"
" -h, --help 显示帮助信息\n"
Expand Down
Loading
Loading