cg-commit(1) - Linux man page
Name
cg-commit - commit into a git repository
Synopsis
cg-commit [-m MESSAGE]... [-e] [-c COMMIT_ID] [OTHER_OPTIONS] [FILE]... [< MESSAGE]
Description
Commits your changes to the GIT repository. Accepts the commit message from stdin. If the commit message is not modified the commit will be aborted.
By default, the commit is recorded as made by you, but you can change that - useful if you are e.g. applying a patch submitted by someone else. See the ENVIRONMENT section below.
Note that you can undo a commit by the gitlink:cg-admin-uncommit[1] command, but that is possible only under special circumstances. See the CAVEATS section of its documentation.
Options
-c COMMIT_ID
- Copy the commit from a given commit ID (that is the author information and the commit message - NOT committer information). This option is typically used when replaying commits from one lineage or repository to another - see also cg-patch -C.
- -C
- Make gitlink:cg-commit[1] ignore the cache and just commit the thing as-is. Note, this is used internally by Cogito when merging, and it is also useful when you are performing the initial commit manually. This option does not make sense when files are given on the command line.
- -m MESSAGE
- Specify the commit message, which is used instead of starting up an editor (if the input is not stdin, the input is appended after all the -m messages). Multiple -m parameters are appended to a single commit message, each as separate paragraph.
- -M FILE
- Include commit message from a file (this has the same effect as if you would cat it to stdin).
- -e
- Force the editor to be brought up even when -m parameters were passed to gitlink:cg-commit[1].
- -E
- Force the editor to be brought up and do the commit even if the default commit message is not changed.
- -f
- Force the commit even when there's "nothing to commit", that is the tree is the same as the last time you committed, no changes happened. This also forces the commit even if committing is blocked for some reason.
- -N
- Don't add the files to the object database, just update the caches and the commit information. This is for special purposes when you might not actually have any object database. This option is normally not interesting.
- -q
- Be quiet in case there's "nothing to commit", and silently exit returning success. In a sense, this is the opposite to -f.
- -s, --signoff
- Add Signed-off-by line at the end of the commit message. Optionally, specify the exact name and email to sign off with by passing: --signoff="Author Name <user@example.com>".
- --review
- Show changes being commited as a patch appended to the commit message buffer. Changes made to the patch will be reapplied before completing the commit. This only makes sense if you are going to edit the commit message interactively.
- -h, --help
- Print usage summary.
- --long-help
- Print user manual. The same as found in gitlink:cg-commit[1].
Files
$GIT_DIR/author
- If exists, it should be in the format Person Name <email@addy [1] > (both parts are optional) and the GIT_AUTHOR_* environment variables will be set accordingly if they are not present in the environment yet.
- $GIT_DIR/commit-template
- If the file exists it will be used as a template when creating the commit message. The template file makes it possible to automatically add Signed-off-by line to the log message.
- $GIT_DIR/hooks/commit-post
- If the file exists and is executable it will be executed upon completion of the commit. The script is passed two arguments. The first
argument is the commit ID and the second is the branchname. A sample commit-post script might look like:
#!/bin/sh id=$1 branch=$2 echo "Committed $id in $branch" | mail user@host
Environment Variables
GIT_AUTHOR_NAME
- Author's name. This defaults to the GECOS field of your /etc/passwd entry, which is taken almost verbatim. (Note that this is carried over by GIT, not Cogito, and may change in the future GIT versions.)
- GIT_AUTHOR_EMAIL
- Author's e-mail address. This defaults to your username@hostname.domainname [2] , but you should change it to your real email you use if it is different.
- GIT_AUTHOR_DATE
- Date, useful when applying patches submitted over e-mail.
- GIT_COMMITTER_NAME
- Committer's name. It defaults to the same as GIT_AUTHOR_NAME.
- GIT_COMMITTER_EMAIL
- Committer's e-mail address. It defaults to the same as GIT_AUTHOR_EMAIL. The recommended policy is not to change this, though - it may not be necessarily a valid e-mail address, but its purpose is more to identify the actual user and machine where the commit was done. However, it is obviously ultimately a policy decision of a particular project to determine whether this should be a real e-mail or not.
- EDITOR
- The editor used for entering revision log information.
Commit author
- Some general notes about the GIT_AUTHOR_* variables. They describe who is the author of the change being committed. It defaults to
you, but it is considered good practice to change this to the actual author of the change if the patch was submitted by someone else etc.
In the shell, you can set those variables just for a single gitlink:cg-commit[1] call conveniently by doing e.g.:
-
GIT_AUTHOR_NAME="Pav E. Lma" cg-commit -m"Check in stuff."
Configuration Variables
The following GIT configuration file variables are recognized:
cogito.hooks.commit.post.allmerged
- If set to "true" and you are committing a merge, the post-hook will be called for all the merged commits in sequence (the earliest first). Otherwise, the hook will be called only for the merge commit.
Copyright
Copyright © Petr Baudis, 2005
See Also
cg-commit is part of gitlink:cogito[7], a toolkit for managing gitlink:git[7] trees.
Notes
- 1.
email@addy
- mailto:email@addy
- 2.
username@hostname.domainname
- mailto:username@hostname.domainname