blob: 6604e1060602b0cf271606052118a31f31e3a9ec [file] [log] [blame]
Edwin Kempind54ccbd2011-02-07 11:47:05 +01001non-fast forward
2================
3
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
23the remote branch has evolved since you started your development
24----------------------------------------------------------------
25
26You start your development based on the current tip of the remote
27branch. While you implement your feature / bug-fix, a change in Gerrit
28gets submitted (or another user directly pushes a commit) so that the
29remote branch evolves. If you are now pushing your commit, with
30bypassing code review, your push will be rejected with the error
31message 'non-fast forward'. To solve the problem you have to either
Edwin Kempinddfc41a2011-05-06 10:32:05 +020032
33. 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
34. link:http://www.kernel.org/pub/software/scm/git/docs/git-merge.html[merge] your commit with the new tip of the remote branch.
35
Edwin Kempind54ccbd2011-02-07 11:47:05 +010036Afterwards the push should be successful.
37
38
39you are pushing the commit to the wrong project
40-----------------------------------------------
41
42If you do a commit in one project and then accidentally push this
43commit, with bypassing code review, to another project, this will fail
44with the error message 'non-fast forward'. To fix the problem you
45should check the push specification and verify that you are pushing
46the commit to the correct project.
47
48
David Pursehouse221d4f62012-06-08 17:38:08 +090049Although it is considered bad practice, it is possible to allow
Edwin Kempind54ccbd2011-02-07 11:47:05 +010050non-fast forward updates with Git. For this the remote Git repository
51has to be configured to not deny non-fast forward updates (set the
52link:http://www.kernel.org/pub/software/scm/git/docs/git-config.html[Git configuration] parameter 'receive.denyNonFastForwards' to
53'false'). Then it is possible to push a non-fast forward update by
54using the '--force' option.
55
56
57GERRIT
58------
59Part of link:error-messages.html[Gerrit Error Messages]