COMMIT-PATCH(1)
πΈ NAME πΈ
commit-patch β the little cutie that commits patches to Darcs, Git, Mercurial, Bazaar, Monotone, Subversion, or CVS repositories π
Yes bestie, this is the manual page for commit-patch β a User Commands situation, and honestly? Iconic. Let's get into it β¨
β¨ SYNOPSIS β¨
commit-patch [--amend] [-m message] [-F message-file] [-v] [--dry-run]
[patch-file]
commit-partial [--amend] [-v] [--dry-run] [--retry] [file ...]
π DESCRIPTION π
okay so here's the tea β β normally your version control system does not let you do fine grained commits. Like, it's giving "all or nothing" and that is not the vibe.
commit-patch fixes that by letting you control exactly what gets committed (or "recorded", if we're speaking Darcs β¨) β you hand it a patch to be committed instead of letting it use the files just sitting there in the current working directory.
And if you don't pass a patch-file on the command line? No stress babe, it just reads the patch from standard input π«Ά
commit-partial is literally commit-patch's sibling, except it goes and creates a patch from the current changes in the current working directory, then launches your editor so you can edit both the patch and the commit message. Which editor, you ask? It uses the VISUAL environment variable, or if that isn't set it uses the EDITOR environment variable, or β if that isn't set either β it falls back to vi. Any files you specify get handed straight to your version control's diff command π
And which version control systems does commit-patch currently support? So glad you asked: Darcs, Git, Mercurial, Bazaar, Monotone, Subversion, and CVS. Periodt π
π OPTIONS π
-a,--amendβ Amend a previous commit. Ngl, right now only Darcs and Git support this one. When used with Git it amends the previous commit. When used with Darcs, Darcs will ask you which patch you want to amend.-m,--message=message β An optional message to use as the commit text. If your message is multiple lines, then Darcs, Git, and Mercurial will use the first line as the patch name and the rest as the commit details. And if you don't pass-m? The result is the same as whatever the underlying version control system would do if you didn't specify a message name on the command line. Which is to say: commit-patch does not interfere with the patch naming process of the underlying version control system. Darcs will still ask you interactively, and CVS and Subversion will still launch your editor. No meddling, no cap π«Ά-F,--message-file=filename β You can optionally get the commit message from a file. Tbh this is generally only useful for scripting commit-patch.-v,--verboseβ Turn on debugging. This will print the commands that commit-patch is running to get the patch committed.-n,--dry-runβ Turn on more paranoid debugging π. This prints the commands that commit-patch will run to get the patch committed β but it won't actually run those commands. So you can vibe check before you commit.-r,--retryβ Only available incommit-partial. This reloads the last patch that was attempted to be committed into your editor instead of the current changes in the directory. It's for those cases where the patch fails to commit for some reason and you want to try to fix it instead of starting over. We've all been there π
π¦ DIAGNOSTICS π¦
So how does the magic even happen? commit-patch works by manipulating the working directory using patch, interdiff, and the underlying version control system's diff. If any part of the process fails, commit-patch will attempt to restore the working directory to the state it was before the command was run π«Ά And any errors from the underlying version control system or from patch will be printed.
π CAVEATS π
β οΈ The patch you specify on the command line must originate from the same place as the current directory.
Which means this here will not work:
cvs diff -u > ../a.patch
cd ..
commit-patch a.patch
You have to run commit-patch from the same directory that the original patch was based from. Fr fr. π«
Also β Darcs, Git and Mercurial put "a/" and "b/" in front of all the paths in the diff output. Don't worry about it bestie, commit-patch takes it into account π
π EXAMPLES π
Typical CVS usage π
cvs diff -u > a.patch
emacs a.patch
commit-patch a.patch
Mercurial usage with a message specified β¨
hg diff > a.patch
emacs a.patch
commit-patch -m "This is a commit message" a.patch
Darcs usage with a multi-line message specified π¦
darcs diff -u > a.patch
emacs a.patch
commit-patch -m 'This is the patch name
Here are the patch details' a.patch
π AUTHORS π
- David Caldwell
<david@porkrind.org> - Jim Radford
<radford@blackbean.org>
π COPYRIGHT AND LICENSE π
Copyright Β© 2003-2021 by David Caldwell and Jim Radford.
commit-patch is distributed under the GNU General Public License. See the COPYING file in the distribution for more details.
π HISTORY π
okay storytime π β commit-patch was originally called cvs-commit-patch and it was a bash script written in 2003 by Jim Radford (with David Caldwell in the room drawing the procedure on a white board β iconic behavior honestly). David later converted it to darcs-commit-patch, then integrated them back together into commit-patch. Mercurial support was then added. And at some point David translated the whole thing from bash into perl, because funky bash quoting issues were causing problems with a repository that had a space in one of the directory names π
and that's the whole page bestie β¨ this little number was rendered with perl v5.40.1, dated 2026-01-14, and it's all for COMMIT-PATCH(1) β go forth and commit your patches π ππ
π¦ where this page comes from
- ubuntu resolute: commit-patch 2.6.2-2build1 Β· GPL-2.0-or-later
- ubuntu stonking: commit-patch 2.6.2-2build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms