blob: 923132e17402f8922d96ad722dd68881e1fcb018 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= non-fast forward
Edwin Kempind54ccbd2011-02-07 11:47:05 +01002
David Pursehouse221d4f62012-06-08 17:38:08 +09003With this error message Gerrit rejects a push if the remote branch can't
Edwin Kempind54ccbd2011-02-07 11:47:05 +01004be fast forwarded onto the pushed commit. This is the case if the
5pushed commit is not based on the current tip of the remote branch.
6
7If a non-fast forward update would be done, all commits from the
8remote branch that succeed the base commit of the pushed commit would
9be removed. This would be especially confusing for other users that
David Pursehouse221d4f62012-06-08 17:38:08 +090010have based their work on such a commit. Because of this Git by
11default does not allow non-fast forward updates.
Edwin Kempind54ccbd2011-02-07 11:47:05 +010012
13When working with Gerrit, this error can only occur if
14link:user-upload.html#bypass_review[code review is bypassed].
15
16There are different reasons why this error can occur:
Edwin Kempinddfc41a2011-05-06 10:32:05 +020017
18. the remote branch has evolved since you started your development
19. you are pushing the commit to the wrong project
Edwin Kempind54ccbd2011-02-07 11:47:05 +010020
21
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080022== the remote branch has evolved since you started your development
Edwin Kempind54ccbd2011-02-07 11:47:05 +010023
24You start your development based on the current tip of the remote
25branch. While you implement your feature / bug-fix, a change in Gerrit
26gets submitted (or another user directly pushes a commit) so that the
27remote branch evolves. If you are now pushing your commit, with
28bypassing code review, your push will be rejected with the error
29message 'non-fast forward'. To solve the problem you have to either
Edwin Kempinddfc41a2011-05-06 10:32:05 +020030
31. link:http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html[rebase] your commit on the new tip of the remote branch or
32. link:http://www.kernel.org/pub/software/scm/git/docs/git-merge.html[merge] your commit with the new tip of the remote branch.
33
Edwin Kempind54ccbd2011-02-07 11:47:05 +010034Afterwards the push should be successful.
35
36
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080037== you are pushing the commit to the wrong project
Edwin Kempind54ccbd2011-02-07 11:47:05 +010038
39If you do a commit in one project and then accidentally push this
40commit, with bypassing code review, to another project, this will fail
41with the error message 'non-fast forward'. To fix the problem you
42should check the push specification and verify that you are pushing
43the commit to the correct project.
44
45
David Pursehouse221d4f62012-06-08 17:38:08 +090046Although it is considered bad practice, it is possible to allow
Edwin Kempind54ccbd2011-02-07 11:47:05 +010047non-fast forward updates with Git. For this the remote Git repository
48has to be configured to not deny non-fast forward updates (set the
49link:http://www.kernel.org/pub/software/scm/git/docs/git-config.html[Git configuration] parameter 'receive.denyNonFastForwards' to
50'false'). Then it is possible to push a non-fast forward update by
51using the '--force' option.
52
53
54GERRIT
55------
56Part of link:error-messages.html[Gerrit Error Messages]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -070057
58SEARCHBOX
59---------