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