Home Explore Blog CI



git

7th chunk of `Documentation/git-fast-import.adoc`
a190f5ae411722c682850b961288fa1c88b8ba41e530be020000000100000fa0
 to make the commit on.
Typically branch names are prefixed with `refs/heads/` in
Git, so importing the CVS branch symbol `RELENG-1_0` would use
`refs/heads/RELENG-1_0` for the value of `<ref>`.  The value of
`<ref>` must be a valid refname in Git.  As `LF` is not valid in
a Git refname, no quoting or escaping syntax is supported here.

A `mark` command may optionally appear, requesting fast-import to save a
reference to the newly created commit for future use by the frontend
(see below for format).  It is very common for frontends to mark
every commit they create, thereby allowing future branch creation
from any imported commit.

The `data` command following `committer` must supply the commit
message (see below for `data` command syntax).  To import an empty
commit message use a 0 length data.  Commit messages are free-form
and are not interpreted by Git.  Currently they must be encoded in
UTF-8, as fast-import does not permit other encodings to be specified.

Zero or more `filemodify`, `filedelete`, `filecopy`, `filerename`,
`filedeleteall` and `notemodify` commands
may be included to update the contents of the branch prior to
creating the commit.  These commands may be supplied in any order.
However it is recommended that a `filedeleteall` command precede
all `filemodify`, `filecopy`, `filerename` and `notemodify` commands in
the same commit, as `filedeleteall` wipes the branch clean (see below).

The `LF` after the command is optional (it used to be required).  Note
that for reasons of backward compatibility, if the commit ends with a
`data` command (i.e. it has no `from`, `merge`, `filemodify`,
`filedelete`, `filecopy`, `filerename`, `filedeleteall` or
`notemodify` commands) then two `LF` commands may appear at the end of
the command instead of just one.

`author`
^^^^^^^^
An `author` command may optionally appear, if the author information
might differ from the committer information.  If `author` is omitted
then fast-import will automatically use the committer's information for
the author portion of the commit.  See below for a description of
the fields in `author`, as they are identical to `committer`.

`committer`
^^^^^^^^^^^
The `committer` command indicates who made this commit, and when
they made it.

Here `<name>` is the person's display name (for example
``Com M Itter'') and `<email>` is the person's email address
(``\cm@example.com'').  `LT` and `GT` are the literal less-than (\x3c)
and greater-than (\x3e) symbols.  These are required to delimit
the email address from the other fields in the line.  Note that
`<name>` and `<email>` are free-form and may contain any sequence
of bytes, except `LT`, `GT` and `LF`.  `<name>` is typically UTF-8 encoded.

The time of the change is specified by `<when>` using the date format
that was selected by the --date-format=<fmt> command-line option.
See ``Date Formats'' above for the set of supported formats, and
their syntax.

`gpgsig`
^^^^^^^^

The optional `gpgsig` command is used to include a PGP/GPG signature
that signs the commit data.

Here <alg> specifies which hashing algorithm is used for this
signature, either `sha1` or `sha256`.

NOTE: This is highly experimental and the format of the data stream may
change in the future without compatibility guarantees.

`encoding`
^^^^^^^^^^
The optional `encoding` command indicates the encoding of the commit
message.  Most commits are UTF-8 and the encoding is omitted, but this
allows importing commit messages into git without first reencoding them.

`from`
^^^^^^
The `from` command is used to specify the commit to initialize
this branch from.  This revision will be the first ancestor of the
new commit.  The state of the tree built at this commit will begin
with the state at the `from` commit, and be altered by the content
modifications in this commit.

Omitting the `from` command in the first commit of a new branch
will cause fast-import to create that commit with no ancestor. This
tends to be desired only for the initial commit of

Title: Git Fast Import Commit Syntax and Options
Summary
The commit command in git-fast-import has various options and syntax, including specifying the branch, author, committer, commit message, and file modifications, as well as optional commands for GPG signatures, encoding, and initializing the branch from a previous commit, allowing for flexible and detailed control over the import process.