'\" t
.\" Title: stg-publish
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.78.1
.\" Date: 03/26/2014
.\" Manual: StGit Manual
.\" Source: StGit
.\" Language: English
.\"
.TH "STG\-PUBLISH" "1" "03/26/2014" "StGit" "StGit Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
stg-publish \- Push the stack changes to a merge\-friendly branch
.SH "SYNOPSIS"
.sp
.nf
\fIstg\fR publish [options] [\-\-] [branch]
.fi
.SH "DESCRIPTION"
This command commits a set of changes on a separate (called public) branch based on the modifications of the given or current stack\&. The history of the public branch is not re\-written, making it merge\-friendly and feasible for publishing\&. The heads of the stack and public branch may be different but the corresponding tree objects are always the same\&.
If the trees of the stack and public branch are different (otherwise the command has no effect), StGit first checks for a rebase of the stack since the last publishing\&. If a rebase is detected, StGit creates a commit on the public branch corresponding to a merge between the new stack base and the latest public head\&.
If no rebasing was detected, StGit checks for new patches that may have been created on top of the stack since the last publishing\&. If new patches are found and are not empty, they are checked into the public branch keeping the same commit information (e\&.g\&. log message, author, committer, date)\&.
If the above tests fail (e\&.g\&. patches modified or removed), StGit creates a new commit on the public branch having the same tree as the stack but the public head as its parent\&. The editor will be invoked if no "\-\-message" option is given\&.
It is recommended that stack modifications falling in different categories as described above are separated by a publish command in order to keep the public branch history cleaner (otherwise StGit would generate a big commit including several stack modifications)\&.
The \fI\-\-unpublished\fR option can be used to check if there are applied patches that have not been published to the public branch\&. This is done by trying to revert the patches in the public tree (similar to the \fIpush \-\-merged\fR detection)\&. The \fI\-\-last\fR option tries to find the last published patch by checking the SHA1 of the patch tree agains the public tree\&. This may fail if the stack was rebased since the last publish command\&.
The public branch name can be set via the branch\&.\&.public configuration variable (defaulting to "\&.public")\&.
.SH "OPTIONS"
.PP
\-b BRANCH, \-\-branch BRANCH
.RS 4
Use BRANCH instead of the default branch\&.
.RE
.PP
\-l, \-\-last
.RS 4
Show the last published patch\&.
.RE
.PP
\-u, \-\-unpublished
.RS 4
Show applied patches that have not been published\&.
.RE
.PP
\-\-author "NAME "
.RS 4
Set the author details\&.
.RE
.PP
\-\-authname NAME
.RS 4
Set the author name\&.
.RE
.PP
\-\-authemail EMAIL
.RS 4
Set the author email\&.
.RE
.PP
\-\-authdate DATE
.RS 4
Set the author date\&.
.RE
.PP
\-m MESSAGE, \-\-message MESSAGE
.RS 4
Use MESSAGE instead of invoking the editor\&.
.RE
.PP
\-f FILE, \-\-file FILE
.RS 4
Use the contents of FILE instead of invoking the editor\&. (If FILE is "\-", write to stdout\&.)
.RE
.PP
\-\-sign
.RS 4
Add a "Signed\-off\-by:" to the end of the patch\&.
.RE
.PP
\-\-ack
.RS 4
Add an "Acked\-by:" line to the end of the patch\&.
.RE
.SH "STGIT"
Part of the StGit suite \- see \fBstg\fR(1)