Home Explore Blog CI



git

6th chunk of `Documentation/git-fast-import.adoc`
bf4f63db4c068b944cd60fb77d9b959aba29bb68e7602d370000000100000fa2

`tag`::
	Creates an annotated tag object from an existing commit or
	branch.  Lightweight tags are not supported by this command,
	as they are not recommended for recording meaningful points
	in time.

`reset`::
	Reset an existing branch (or a new branch) to a specific
	revision.  This command must be used to change a branch to
	a specific revision without making a commit on it.

`blob`::
	Convert raw file data into a blob, for future use in a
	`commit` command.  This command is optional and is not
	needed to perform an import.

`alias`::
	Record that a mark refers to a given object without first
	creating any new object.  Using --import-marks and referring
	to missing marks will cause fast-import to fail, so aliases
	can provide a way to set otherwise pruned commits to a valid
	value (e.g. the nearest non-pruned ancestor).

`checkpoint`::
	Forces fast-import to close the current packfile, generate its
	unique SHA-1 checksum and index, and start a new packfile.
	This command is optional and is not needed to perform
	an import.

`progress`::
	Causes fast-import to echo the entire line to its own
	standard output.  This command is optional and is not needed
	to perform an import.

`done`::
	Marks the end of the stream. This command is optional
	unless the `done` feature was requested using the
	`--done` command-line option or `feature done` command.

`get-mark`::
	Causes fast-import to print the SHA-1 corresponding to a mark
	to the file descriptor set with `--cat-blob-fd`, or `stdout` if
	unspecified.

`cat-blob`::
	Causes fast-import to print a blob in 'cat-file --batch'
	format to the file descriptor set with `--cat-blob-fd` or
	`stdout` if unspecified.

`ls`::
	Causes fast-import to print a line describing a directory
	entry in 'ls-tree' format to the file descriptor set with
	`--cat-blob-fd` or `stdout` if unspecified.

`feature`::
	Enable the specified feature. This requires that fast-import
	supports the specified feature, and aborts if it does not.

`option`::
	Specify any of the options listed under OPTIONS that do not
	change stream semantic to suit the frontend's needs. This
	command is optional and is not needed to perform an import.

`commit`
~~~~~~~~
Create or update a branch with a new commit, recording one logical
change to the project.

////
Yes, it's intentional that the 'gpgsig' line doesn't have a trailing
`LF`; the definition of `data` has a byte-count prefix, so it
doesn't need an `LF` to act as a terminator (and `data` also already
includes an optional trailing `LF?` just in case you want to include
one).
////

....
	'commit' SP <ref> LF
	mark?
	original-oid?
	('author' (SP <name>)? SP LT <email> GT SP <when> LF)?
	'committer' (SP <name>)? SP LT <email> GT SP <when> LF
	('gpgsig' SP <alg> LF data)?
	('encoding' SP <encoding> LF)?
	data
	('from' SP <commit-ish> LF)?
	('merge' SP <commit-ish> LF)*
	(filemodify | filedelete | filecopy | filerename | filedeleteall | notemodify)*
	LF?
....

where `<ref>` is the name of the branch 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`,

Title: Git Fast Import Commands and Commit Syntax
Summary
The git-fast-import command supports various commands, including 'tag', 'reset', 'blob', 'alias', 'checkpoint', 'progress', 'done', 'get-mark', 'cat-blob', 'ls', 'feature', and 'option', which are used to manage the import process, and the 'commit' command, which creates or updates a branch with a new commit, with a specific syntax that includes fields such as 'author', 'committer', 'gpgsig', 'encoding', and 'data' to record changes to the project.