stg-import — Import a GNU diff file as a new patch


stg import [options] [--] [<file>|<url>]


Create a new patch and apply the given GNU diff file (or the standard input). By default, the file name is used as the patch name but this can be overridden with the --name option. The patch can either be a normal file with the description at the top or it can have standard mail format, the Subject, From and Date headers being used for generating the patch information. The command can also read series and mbox files.

If a patch does not apply cleanly, the failed diff is written to the .stgit-failed.patch file and an empty StGIT patch is added to the stack.

The patch description has to be separated from the data with a --- line.


-m, --mail

Import the patch from a standard e-mail file.

-M, --mbox

Import a series of patches from an mbox file.

-s, --series

Import a series of patches from a series file or a tar archive.

-u, --url

Import a patch from a URL.

-n NAME, --name NAME

Use NAME as the patch name.

-p N, --strip N

Remove N leading slashes from diff paths (default 1).

-t, --stripname

Strip numbering and extension from patch name.

-i, --ignore

Ignore the applied patches in the series.


Replace the unapplied patches in the series.

-b BASE, --base BASE

Use BASE instead of HEAD for file importing.


Leave the rejected hunks in corresponding *.rej files.

-e, --edit

Invoke an editor for the patch description.

-d, --showdiff

Show the patch content in the editor buffer.

--author "NAME <EMAIL>"

Set the author details.

--authname NAME

Set the author name.

--authemail EMAIL

Set the author email.

--authdate DATE

Set the author date.


Add a "Signed-off-by:" to the end of the patch.


Add an "Acked-by:" line to the end of the patch.


Add a "Reviewed-by:" line to the end of the patch.


Part of the StGit suite - see stg(1)


11/20/2019 StGit Manual