GIT-PUBLISH(1)
π GIT-PUBLISH(1) β git-publish Documentation
okay bestie, welcome to the git-publish manual page, straight outta the git-publish Documentation set. this is the one you've been waiting for. grab a strawberry π and let's go.
β¨ NAME β¨
git-publish β prepare and store patch revisions as git tags
π¦ SYNOPSIS π¦
git-publish [options] -- [common format-patch options]
π DESCRIPTION π
so like, git-publish prepares patches and stores them as git tags so you have them for future reference. it works with individual patches and whole patch series, and the revision numbering? handled automatically. you don't have to think about it. it's giving effortless. β¨
no constraints are placed on your git workflow, okay? none. both vanilla git commands and custom workflow scripts are compatible with git-publish. do your thing, queen. π
email sending and pull requests are fully integrated, so publishing patches can be done in a single command. one command. that's it. that's the whole vibe. π
hook scripts get invoked during patch preparation, so custom checks or test runs can be automated. it's giving set it and forget it. π
π₯ OPTIONS π₯
--versionβ Show program's version number and exit. short and sweet, love that for us.-h,--helpβ Show help message and exit. the classic. the icon. the legend. π--annotateβ Review and edit each patch email. yes, each one. main character energy for every single email.-bBASE,--base=BASE β Branch which this is based off (defaults tomaster). so like, where are we branching from, bestie? defaults tomasterif you don't say.--cc=CC β Specify aCc:email recipient. tag them in, bestie. π«Ά--cc-cmd=CC_CMD β Specify a command add whose output to add theCc:email recipient list. Seegit-send-email(1)for details. yeah we're letting a whole command pick your cc list, iykyk.--no-check-urlβ Do not check whether the pull request URL is publicly accessible.--check-urlβ Check whether the pull request URL is publicly accessible. This is the default. lowkey responsible of it tbh.--skip=N β Unselect the first N patch emails (including the cover letter if any). If negative, select only the last -N patches. so you can skip from the front, or grab from the back if it's negative. β¨--editβ Edit message but do not tag a new version. Use this to draft the cover letter before actually tagging a new version. drafting era. π--no-inspect-emailsβ Do not prompt for confirmation before sending emails. living dangerously, no notes. π--inspect-emailsβ Show confirmation before sending emails. the responsible girlie option.-nNUMBER,--number=NUMBER β Explicitly specify the version number (auto-generated by default). you can pick your own number but like, it already does this for you.--no-message,--no-cover-letterβ Do not add a message.-m,--message,--cover-letterβ Add a message. β¨--no-binaryβ Do not output contents of changes in binary files, instead display a notice that those files changed. Patches generated using this option cannot be applied properly, but they are still useful for code review.
β οΈ okay heads up: with --no-binary your patches cannot be applied properly. they're still useful for code review tho, so like, it's a tradeoff. know what you're getting into. π«£
-pPROFILE_NAME,--profile=PROFILE_NAME β Select default settings from the given profile. presets, but make it fashion. π--pull-requestβ Tag and send as a pull request.--sign-pullβ Sign tag when sending pull request.--no-sign-pullβ Do not sign tag when sending pull request.-kKEYID,--keyid=KEYID β Use the given GPG key to sign tag when sending pull request--blurb-templateβ Use a pre-defined blurb message for the series HEAD.--subject-prefix=PREFIX β Set the emailSubject:header prefix.--clear-subject-prefixβ Clear the per-branch subject prefix. The subject prefix persists between versions by default. Use this option to reset it. it's been holding onto that prefix forever, bestie. time to let it go. π¦--setupβ Add git alias in~/.gitconfigso that thegit publishgit sub-command works. one-time glow-up for your config. β¨-tTOPIC,--topic=TOPIC β Set the topic name (defaults to current branch name).--to=TO β Specify a primary email recipient.-s,--signoffβ AddSigned-off-by: <self>to commits when emailing.--notesβ Append the notes for the commit after the three-dash line. Seegit-notes(1)for details.--suppress-cc=SUPPRESS_CC β Override auto-cc when sending email. Seegit-send-email(1)for details.-v,--verboseβ Show executed git commands (useful for troubleshooting). when something's acting up and you need to see everything. π--forget-ccβ Forget all previousCc:email addresses. memory wipe. it never happened. π--override-toβ Ignore any profile or savedTo:email addresses.--override-ccβ Ignore any profile or savedCc:email addresses.-RIN_REPLY_TO,--in-reply-to=IN_REPLY_TO β Specify theIn-Reply-To:of the first email, or of all emails if--no-threadis given or is otherwise the default.--no-threadβ Do not addIn-Reply-To:andReferences:headers to any email. This may be the default depending on yourgit-send-email(1)configuration.--threadβ AddIn-Reply-To:andReferences:headers to sent emails. This may be the default depending on yourgit-send-email(1)configuration, which also controls whether each email refers to the previous email or to the first email.--send-email-argsβ List of arguments that are forwarded to thegit-send-emailcall. You can add as many arguments as you need by using consecutive--send-email-argsarguments. stack 'em up, bestie. π§
π¬ DISCUSSION π¬
Okay bestie, so now we're getting into the actual how-to. This is where it gets good. β¨
π οΈ Setup π οΈ
First things first: run git-publish in setup mode to configure the git alias. Like this:
$ git-publish --setup
Boom. Now you can use git publish just like it's a built-in git command. No cap. π
π Quickstart π
So you wanna do some work? Make a "topic branch" for your feature or bug fix. Like:
$ git checkout -b add-funny-jokes
...
$ git commit
...
$ git commit
Then send a patch series via email:
$ git publish --to patches@example.org --cc maintainer@example.org
Get some review comments? Address them and send a new revision:
$ git rebase -i master
...
$ git publish --to patches@example.org --cc maintainer@example.org
Wanna look back at older revisions? Easy:
$ git show add-funny-jokes-v1
And that's the basic workflow for sending patch series. Iconic. π
π¦ Storing patch revisions π¦
To store the first revision of a patch series:
$ git checkout my-feature
$ git publish
This creates the my-feature-v1 git tag. Run git-publish again later and it'll make tags with incrementing version numbers:
my-feature-v1
my-feature-v2
my-feature-v3
...
To refer back to a previous version, just check out that git tag. That way you keep a record of each patch revision you've published. Obsessed. π
π’ Overriding the version number π’
You can set the version number manually. Super handy if you're starting with git-publish on branches that were previously manually versioned:
$ git checkout my-existing-feature
$ git publish --number 7
This creates the my-existing-feature-v7 tag. Slay.
πΏ Overriding the branch name πΏ
By default, git-publish refuses to create a revision for the 'master' branch. Usually you work with topic branchesβone branch per feature. Using 'master' might mean you forgot to switch to your topic branch. But you can override the topic name and even publish on 'master':
$ git checkout branch-a
$ git publish --topic branch-b
This creates branch-b-v1 instead of branch-a-v1 and can be used to skip the check for 'master'. Yasss.
π·οΈ Tag messages π·οΈ
Tag messages have a summary (or subject line) and a description (or blurb). When you use send email integration, the summary goes into the cover letter Subject: line and the description goes into the body.
When prompting for tag messages on v2, v3, or other incremental revisions, the previous revision's tag message is used as the starting point. This is handy for updating the existing description and keeping a changelog of the difference between revisions.
The git-config(1) format.coverLetter value is honored. The default 'auto' value adds a cover letter if there is more than 1 patch. The cover letter can also be forced with 'true' or 'false'.
To insist on creating a tag message:
$ git publish --message
To refrain from creating a tag message:
$ git publish --no-message
For convenience, these options are also available as --cover-letter and --no-cover-letter just like in git-format-patch(1). Periodt. π
βοΈ Editing tag messages without publishing βοΈ
Sometimes it's useful to edit the tag message before publishing. You can note down changelog entries as you prepare the next version of a patch series.
To edit the tag message without publishing:
$ git publish --edit
This does not tag a new version. Instead a -staging tag will be created and the tag message will be picked up when you publish next time. For example, if you're on branch my-feature and have already published v1 and v2, editing the tag message will create the tag my-feature-staging. When you publish next time, the my-feature-v3 tag will be created and use the tag message you staged earlier. Big brain energy. π§
π§± Setting the base branch π§±
git-publish detects whether the branch contains a single commit or multiple commits by comparing against a base branch ('master' by default). You can specify the base branch like this:
$ git publish --base my-parent
Most of the time 'master' works fine.
It's also possible to persist which base branch to use. This is useful if you find yourself often specifying a base branch manually. You can do it globally for all branches in a repository or just for a specific branch:
$ git config git-publish.base origin/master # for all branches
$ git config branch.foo.gitpublishbase origin/master # for one branch
Lowkey a lifesaver. π
π§ Send email integration π§
git-publish can call git-send-email(1) after creating a git tag. If there's a tag message, it'll be used as the cover letter. Send email like this:
$ git publish --to patches@example.org \
--cc alex@example.org --cc bob@example.org
After the git tag has been created as usual, commits on top of the base branch are sent as the patch series. The base branch defaults to 'master' and can be set manually with --base.
The git-send-email(1) aliasesfile feature works since the email addresses are passed through without interpretation by git-publish.
Patch emails can be manually edited before being sentβthese changes only affect outgoing emails and are not stored permanently:
$ git publish --to patches@example.org --annotate
git-publish can background itself so patch emails can be inspected from the shell:
$ git publish --to patches@example.org --inspect-emails
Signed-off-by: <self> lines can be applied to patch emailsβonly outgoing emails are affected and not the local git commits:
$ git publish --to patches@example.org --signoff
Sending [RFC] series instead of regular [PATCH] series can be done by customizing the Subject: line:
$ git publish --to patches@example.org --subject-prefix RFC
Using this way, specified "--subject-prefix" will be stored as per-branch subject prefix, and will be used for the next git-publish as well.
You can override the stored per-branch subject prefix by providing the --subject-prefix parameter again, or to clear it permanently, use:
$ git publish --clear-subject-prefix
git-publish remembers the list of addresses CC'd on previous revisions of a patchset by default. To clear that internal list:
$ git publish --to patches@example.org --forget-cc --cc new@example.org
In the above example, new@example.org will be saved to the internal list for next time.
CC addresses accumulate and cascade. Following the previous example, if we want to send a new version to both new@example.org and old@example.org:
$ git-publish --cc old@example.org
To temporarily ignore any CCs in the profile or saved list, and send only to the addresses specified on the CLI:
$ git-publish --override-cc --cc onetime@example.org --to patches@example.org
CCs specified alongside --override-cc are not remembered for future revisions.
$ git publish --to patches@example.org --notes
To include git-notes into a patch.
You can attach notes to a commit with git notes add <object>. For having the notes "following" a commit on rebase operation, you can use git config notes.rewriteRef refs/notes/commits. For more information, give a look at git-notes(1).
To have git-send-email add a cc list to individual patch emails we use:
$ git-publish --cc patches@example.org --send-email-args="--cc-cmd" --send-email-args="SCRIPT"
That's a lot of email magic. π
π§βπ» Creating profiles for frequently used projects π§βπ»
Instead of providing command-line options each time a patch series is published, the options can be stored in git-config(1) files:
$ cat >>.git/config
[gitpublishprofile "example"]
prefix = PATCH for-example
to = patches@example.org
cc = maintainer1@example.org
cc = maintainer2@example.org
^D
$ git checkout first-feature
$ git publish --profile example
$ git checkout second-feature
$ git publish --profile example
The "example" profile is equivalent to the following command-line:
$ git publish --subject-prefix 'PATCH for-example' --to patches@example.org --cc maintainer1@example.org --cc maintainer2@example.org
If command-line options are given together with a profile, then the command-line options take precedence. So CLI wins, always. πͺ
The following profile options are available:
[gitpublishprofile "example"]
base = v2.1.0 # same as --base
remote = origin # used if branch.<branch-name>.remote not set
prefix = PATCH # same as --patch
to = patches@example.org # same as --to
cc = maintainer@example.org # same as --cc
suppresscc = all # same as --suppress-cc
message = true # same as --message
signoff = true # same as --signoff
inspect-emails = true # same as --inspect-emails
notes = true # same as --notes
blurb-template = A blurb template # same as --blurb-template
The special "default" profile name is active when no --profile command-line option was given. The default profile does not set any options but can be extended in git-config(1) files:
$ cat >>.git/config
[gitpublishprofile "default"]
suppresscc = all # do not auto-cc people
If a file named .gitpublish exists in the repository top-level directory, it is automatically searched in addition to the git-config(1) .git/config and ~/.gitconfig files. Since the .gitpublish file can be committed into git, this can be used to provide a default profile for branches that you expect to repeatedly use as a base for new work. Chef's kiss. π¨βπ³π
π Sending pull requests π
git-publish can send signed pull requests. Signed tags are pushed to a remote git repository that must be readable by the person who will merge the pull request.
Ensure that the branch has a default remote repository saved:
$ git config branch.foo.remote my-public-repo
The remote must be accessible to the person receiving the pull request. Normally the remote URI should be git:// or https://. If the remote is configured for ssh:// then git-config(1) can be supplemented with a public url and private pushurl. This ensures that pull requests always use the public URI:
[remote "<name>"]
url = https://myhost.com/repo.git
pushurl = me@myhost.com:repo.git
Send a pull request:
$ git publish --pull-request --to patches@example.org --annotate
And that's how you slide into someone's DMs with a pull request. π
β¨ CONFIGURATION β¨
okay bestie so there are three possible levels of configuration, and they have an order of precedence β like a lil hierarchy, and the little ones win over the big ones π
- Per-branch options only apply to a specific branch.
- Per-profile options apply when the profile is enabled with
--profile. - Global options apply in all cases.
Here's every config option you can set, no gatekeeping π«Ά
branch.BRANCHNAME.gitpublishbasegitpublishprofile.PROFILENAME.basegit-publish.baseβ same energy as the--baseoption πbranch.BRANCHNAME.gitpublishtogitpublishprofile.PROFILENAME.toβ same as the--tooptionbranch.BRANCHNAME.gitpublishccgitpublishprofile.PROFILENAME.ccβ same as the--ccoptionbranch.BRANCHNAME.gitpublishcccmdgitpublishprofile.PROFILENAME.gitpublishcccmdβ same as the--cc-cmdoptiongitpublishprofile.PROFILENAME.remoteβ the remote where the pull request tag will be pushed π€gitpublishprofile.PROFILENAME.messageβ same as the--messageoptionbranch.BRANCHNAME.gitpublishprefixgitpublishprofile.PROFILENAME.prefixβ same as the--subject-prefixoptiongitpublishprofile.PROFILENAME.suppressccβ same as the--suppress-ccoptiongitpublishprofile.PROFILENAME.signoffβ same as the--signoffoptiongitpublishprofile.PROFILENAME.inspect-emailsβ same as the--inspect-emailsoptiongitpublishprofile.PROFILENAME.notesβ same as the--notesoptiongitpublishprofile.PROFILENAME.checkUrlgit-publish.checkUrlβ same as the--no-check-urland--check-urloptionsgitpublishprofile.PROFILENAME.signPullgit-publish.signPullβ same as the--no-sign-pulland--sign-pulloptionsgit-publish.signingkeyβ same as the--keyidoption
πͺ HOOKS πͺ
not me being obsessed with the fact that git-publish supports the githooks(5) mechanism for running user scripts at important points during the workflow π¦
and like, the script can genuinely influence the outcome of the operation β for example, by rejecting a patch series that is about to be sent out. main character behaviour tbh π€
Available hooks include:
pre-publish-send-emailβ invoked beforegit-send-email(1). Takes the path to the patches directory as an argument. If the exit code is non-zero, the series will not be sent π«pre-publish-tagβ invoked before creating the-stagingtag on current branch. Takes one argument which refers to the base commit or branch. If the exit code is non-zero,git-publishwill abort π
π SEE ALSO π
π AUTHOR π
Stefan Hajnoczi <mailto:stefanha@gmail.com>
π COPYRIGHT π
Copyright (C) 2011-2018 Stefan Hajnoczi
and that's a wrap on the whole page bestie π no cap, you're basically a git-publish expert now. this was version 1.8.2, dated 2025-07-23, and it's the GIT-PUBLISH(1) manual page β slay, go publish something iconic β¨π«ΆπΈ
π¦ where this page comes from
- fedora 43: git-publish 1.8.2-4.fc43 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms