blob: 1e9a88f3ac6e9563a8462615fcb2df253b0e46b6 [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08002= non-fast forward
Edwin Kempind54ccbd2011-02-07 11:47:05 +01003
David Pursehouse221d4f62012-06-08 17:38:08 +09004With this error message Gerrit rejects a push if the remote branch can't
Edwin Kempind54ccbd2011-02-07 11:47:05 +01005be fast forwarded onto the pushed commit. This is the case if the
6pushed commit is not based on the current tip of the remote branch.
7
8If a non-fast forward update would be done, all commits from the
9remote branch that succeed the base commit of the pushed commit would
10be removed. This would be especially confusing for other users that
David Pursehouse221d4f62012-06-08 17:38:08 +090011have based their work on such a commit. Because of this Git by
12default does not allow non-fast forward updates.
Edwin Kempind54ccbd2011-02-07 11:47:05 +010013
14When working with Gerrit, this error can only occur if
15link:user-upload.html#bypass_review[code review is bypassed].
16
17There are different reasons why this error can occur:
Edwin Kempinddfc41a2011-05-06 10:32:05 +020018
19. the remote branch has evolved since you started your development
20. you are pushing the commit to the wrong project
Edwin Kempind54ccbd2011-02-07 11:47:05 +010021
22
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080023== the remote branch has evolved since you started your development
Edwin Kempind54ccbd2011-02-07 11:47:05 +010024
25You start your development based on the current tip of the remote
26branch. While you implement your feature / bug-fix, a change in Gerrit
27gets submitted (or another user directly pushes a commit) so that the
28remote branch evolves. If you are now pushing your commit, with
29bypassing code review, your push will be rejected with the error
30message 'non-fast forward'. To solve the problem you have to either
Edwin Kempinddfc41a2011-05-06 10:32:05 +020031
Marian Harbach34253372019-12-10 18:01:31 +010032. link:http://www.kernel.org/pub/software/scm/git/docs/git-rebase.html[rebase,role=external,window=_blank] your commit on the new tip of the remote branch or
33. link:http://www.kernel.org/pub/software/scm/git/docs/git-merge.html[merge,role=external,window=_blank] your commit with the new tip of the remote branch.
Edwin Kempinddfc41a2011-05-06 10:32:05 +020034
Edwin Kempind54ccbd2011-02-07 11:47:05 +010035Afterwards the push should be successful.
36
37
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080038== you are pushing the commit to the wrong project
Edwin Kempind54ccbd2011-02-07 11:47:05 +010039
40If you do a commit in one project and then accidentally push this
41commit, with bypassing code review, to another project, this will fail
42with the error message 'non-fast forward'. To fix the problem you
43should check the push specification and verify that you are pushing
44the commit to the correct project.
45
46
David Pursehouse221d4f62012-06-08 17:38:08 +090047Although it is considered bad practice, it is possible to allow
Edwin Kempind54ccbd2011-02-07 11:47:05 +010048non-fast forward updates with Git. For this the remote Git repository
49has to be configured to not deny non-fast forward updates (set the
Marian Harbach34253372019-12-10 18:01:31 +010050link:http://www.kernel.org/pub/software/scm/git/docs/git-config.html[Git configuration,role=external,window=_blank] parameter 'receive.denyNonFastForwards' to
Edwin Kempind54ccbd2011-02-07 11:47:05 +010051'false'). Then it is possible to push a non-fast forward update by
52using the '--force' option.
53
54
55GERRIT
56------
57Part of link:error-messages.html[Gerrit Error Messages]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -070058
59SEARCHBOX
60---------