# stg-import(1) Manual Page

## NAME

stg-import - Import patches to stack

## SYNOPSIS

    stg import [OPTIONS] <diff-path>
    stg import [OPTIONS] -m [<mail-path>|<Maildir-path>]
    stg import [OPTIONS] -M [<mbox-path>]
    stg import [OPTIONS] -S [<series-path>]
    stg import [OPTIONS] -u <diff-url>
    stg import [OPTIONS] -u -m <mail-url>
    stg import [OPTIONS] -u -M <mbox-url>
    stg import [OPTIONS] -u -S <series-url>

## DESCRIPTION

Import patches from various sources to the stack.

The simplest usage is to import a diff/patch file into the stack from a local file. By default, the file name is used as the patch name, but this can be overridden with --name. 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 will be used for the imported patch’s author details.

Patches may also be imported from a mail file (-m/--mail), an mbox (-M/--mbox), or a series (-S/--series). Furthermore, the -u/--url option allows the patches source to be fetched from a url instead of from a local file.

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

The patch description must be separated from the diff with a "---" line.

## OPTIONS

-m
--mail

  Import patch from an email file

-M
--mbox

  Import patch series from an mbox file

-S
--series

  Import patch series from a series file are tar archive.

-u
--url

  Retrieve source from a url instead of local file

-n <name>
--name=<name>

  Use <name> as the patch name

-p <n>
--strip=<n>

  Remove <n> leading components from diff paths (default 1)

--directory=<root>

  Prepend <root> to all filenames. If a "-p" argument is also passed, it is applied before prepending the new root.

-t
--stripname

  Strip number and extension from patch name

-C <n>

  Ensure <n> lines of matching context for each change

-3
--3way

  Attempt 3-way merge if the patch records the identity of blobs it is supposed to apply to and those blobs are available locally.

-i
--ignore

  Ignore the applied patches in the series

--replace

  Replace the unapplied patches in the series

-b <committish>
--base=<committish>

  Use <committish> instead of HEAD for file importing

--reject

  Leave rejected hunks in ".rej" files

--keep-cr

  Do not remove "\r" from email lines ending with "\r\n"

--message-id

  Create Message-ID trailer in patch description based on the Message-ID email header. This option is applicable when importing with --mail or --mbox. This behavior may also be enabled via the "stgit.import.message-id" configuration option.

-e
--edit

  Invoke editor for patch description

-d
--diff

  Show diff when editing patch description

--no-verify

  Disable commit-msg hook

-s[=<value>]
--signoff[=<value>]

  Add "Signed-off-by" message trailer.

  The value is optional and defaults to the committer name and email. This option may be provided multiple times.

--ack[=<value>]

  Add "Acked-by" message trailer.

  The value is optional and defaults to the committer’s name and email. This option may be provided multiple times.

--review[=<value>]

  Add "Reviewed-by" message trailer.

  The value is optional and defaults to the committer’s name and email. This option may be provided multiple times.

--author=<name-and-email>

  Set the author "name <email>"

--authname=<name>

  Set the author name

--authemail=<email>

  Set the author email

--authdate=<date>

  Set the date the patch was authored.

  Use "now" to use the current time and date.

--committer-date-is-author-date

  Instead of using the current time as the committer date, use the author date of the commit as the committer date.

## StGit

Part of the StGit suite - see stg(1)