Home Explore Blog CI



git

4th chunk of `Documentation/git-p4.adoc`
94611695d38fc5c79042b100575ae7e227b9d881e986f3510000000100000fa0
 create a new
	directory.

--bare::
	Perform a bare clone.  See linkgit:git-clone[1].

Submit options
~~~~~~~~~~~~~~
These options can be used to modify 'git p4 submit' behavior.

--origin <commit>::
	Upstream location from which commits are identified to submit to
	p4.  By default, this is the most recent p4 commit reachable
	from `HEAD`.

-M::
	Detect renames.  See linkgit:git-diff[1].  Renames will be
	represented in p4 using explicit 'move' operations.  There
	is no corresponding option to detect copies, but there are
	variables for both moves and copies.

--preserve-user::
	Re-author p4 changes before submitting to p4.  This option
	requires p4 admin privileges.

--export-labels::
	Export tags from Git as p4 labels. Tags found in Git are applied
	to the perforce working directory.

-n::
--dry-run::
	Show just what commits would be submitted to p4; do not change
	state in Git or p4.

--prepare-p4-only::
	Apply a commit to the p4 workspace, opening, adding and deleting
	files in p4 as for a normal submit operation.  Do not issue the
	final "p4 submit", but instead print a message about how to
	submit manually or revert.  This option always stops after the
	first (oldest) commit.  Git tags are not exported to p4.

--shelve::
	Instead of submitting create a series of shelved changelists.
	After creating each shelve, the relevant files are reverted/deleted.
	If you have multiple commits pending multiple shelves will be created.

--update-shelve CHANGELIST::
	Update an existing shelved changelist with this commit. Implies
	--shelve. Repeat for multiple shelved changelists.

--conflict=(ask|skip|quit)::
	Conflicts can occur when applying a commit to p4.  When this
	happens, the default behavior ("ask") is to prompt whether to
	skip this commit and continue, or quit.  This option can be used
	to bypass the prompt, causing conflicting commits to be automatically
	skipped, or to quit trying to apply commits, without prompting.

--branch <branch>::
	After submitting, sync this named branch instead of the default
	p4/master.  See the "Sync options" section above for more
	information.

--commit (<sha1>|<sha1>..<sha1>)::
    Submit only the specified commit or range of commits, instead of the full
    list of changes that are in the current Git branch.

--disable-rebase::
    Disable the automatic rebase after all commits have been successfully
    submitted. Can also be set with git-p4.disableRebase.

--disable-p4sync::
    Disable the automatic sync of p4/master from Perforce after commits have
    been submitted. Implies --disable-rebase. Can also be set with
    git-p4.disableP4Sync. Sync with origin/master still goes ahead if possible.

Hooks for submit
----------------

p4-pre-submit
~~~~~~~~~~~~~

The `p4-pre-submit` hook is executed if it exists and is executable.
The hook takes no parameters and nothing from standard input. Exiting with
non-zero status from this script prevents `git-p4 submit` from launching.
It can be bypassed with the `--no-verify` command line option.

One usage scenario is to run unit tests in the hook.

p4-prepare-changelist
~~~~~~~~~~~~~~~~~~~~~

The `p4-prepare-changelist` hook is executed right after preparing
the default changelist message and before the editor is started.
It takes one parameter, the name of the file that contains the
changelist text. Exiting with a non-zero status from the script
will abort the process.

The purpose of the hook is to edit the message file in place,
and it is not suppressed by the `--no-verify` option. This hook
is called even if `--prepare-p4-only` is set.

p4-changelist
~~~~~~~~~~~~~

The `p4-changelist` hook is executed after the changelist
message has been edited by the user. It can be bypassed with the
`--no-verify` option. It takes a single parameter, the name
of the file that holds the proposed changelist text. Exiting
with a non-zero status causes the command to abort.

The hook is allowed to edit the changelist file and can be used
to normalize the text into

Title: Git-p4 Submit Options and Hooks
Summary
The git-p4 submit command provides various options to customize its behavior, including specifying the origin commit, detecting renames, preserving user information, and exporting labels. Additionally, several hooks are available to execute custom scripts at different stages of the submit process, such as before submitting, preparing the changelist, and after editing the changelist message.