blob: f6e5c1f31e0e9a48c1b63e0d22f67afb729ea2ec [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Push fails due to commit message
Edwin Kempinc7f9e452010-12-27 09:21:45 +01002
3If Gerrit rejects pushing a commit it is often the case that there is
4an issue with the commit message of the pushed commit. In this case
David Pursehouse221d4f62012-06-08 17:38:08 +09005the problem can often be resolved by fixing the commit message.
Edwin Kempinc7f9e452010-12-27 09:21:45 +01006
7If the commit message of the last commit needs to be fixed you can
8simply amend the last commit (please find a detailed description in
9the link:http://www.kernel.org/pub/software/scm/git/docs/git-commit.html[Git documentation]):
10
11----
12 $ git commit --amend
13----
14
15If you need to fix the commit messages of several commits or of any
16commit other than the last one you have to do an interactive git
17rebase for the affected commits. While doing the interactive rebase
18you can e.g. choose 'reword' for those commits for which you want to
19fix the commit messages. For a detailed description of git rebase
20please check the link:http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html[Git documentation].
21
22Please use interactive git rebase with care as it rewrites existing
23commits. Generally you should never rewrite commits that have already
24been submitted in Gerrit.
25
26[[commit_hooks]]
27Sometimes commit hooks are used to automatically insert/update
28information in the commit message. If such information is missing in
29the commit message of existing commits (e.g. because the commit hook
30was only configured later) rewriting the commits will (re)execute the
31commit hook and so update the commit messages. If you do an
32interactive rebase to achieve this make sure that the affected
33commits are really rewritten, e.g. by choosing 'reword' for all these
34commits and then confirming all the commit messages. Just picking a
35commit may not rewrite it.
36
37
38GERRIT
39------
40Part of link:error-messages.html[Gerrit Error Messages]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -070041
42SEARCHBOX
43---------