diff --git a/Documentation/error-messages.txt b/Documentation/error-messages.txt index 795674b823..98c6393cf5 100644 --- a/Documentation/error-messages.txt +++ b/Documentation/error-messages.txt @@ -17,6 +17,7 @@ Error Messages * link:error-multiple-changeid-lines.html[multiple Change-Id lines in commit message] * link:error-no-common-ancestry.html[no common ancestry] * link:error-no-new-changes.html[no new changes] +* link:error-non-fast-forward.html[non-fast forward] * link:error-not-a-gerrit-administrator[Not a Gerrit administrator] * link:error-not-a-gerrit-project.html[not a Gerrit project] * link:error-not-permitted-to-create.html[Not permitted to create ...] diff --git a/Documentation/error-non-fast-forward.txt b/Documentation/error-non-fast-forward.txt new file mode 100644 index 0000000000..453cd3dab1 --- /dev/null +++ b/Documentation/error-non-fast-forward.txt @@ -0,0 +1,56 @@ +non-fast forward +================ + +With this error message Git rejects a push if the remote branch can't +be fast forwarded onto the pushed commit. This is the case if the +pushed commit is not based on the current tip of the remote branch. + +If a non-fast forward update would be done, all commits from the +remote branch that succeed the base commit of the pushed commit would +be removed. This would be especially confusing for other users that +have based their work on such a commit. Because of this Git is by +default not allowing non-fast forward updates. + +When working with Gerrit, this error can only occur if +link:user-upload.html#bypass_review[code review is bypassed]. + +There are different reasons why this error can occur: +1. the remote branch has evolved since you started your development +2. you are pushing the commit to the wrong project + + +the remote branch has evolved since you started your development +---------------------------------------------------------------- + +You start your development based on the current tip of the remote +branch. While you implement your feature / bug-fix, a change in Gerrit +gets submitted (or another user directly pushes a commit) so that the +remote branch evolves. If you are now pushing your commit, with +bypassing code review, your push will be rejected with the error +message 'non-fast forward'. To solve the problem you have to either +1. 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 +2. link:http://www.kernel.org/pub/software/scm/git/docs/git-merge.html[merge] your commit with the new tip of the remote branch. +Afterwards the push should be successful. + + +you are pushing the commit to the wrong project +----------------------------------------------- + +If you do a commit in one project and then accidentally push this +commit, with bypassing code review, to another project, this will fail +with the error message 'non-fast forward'. To fix the problem you +should check the push specification and verify that you are pushing +the commit to the correct project. + + +Although it is considered as bad practice, it is possible to allow +non-fast forward updates with Git. For this the remote Git repository +has to be configured to not deny non-fast forward updates (set the +link:http://www.kernel.org/pub/software/scm/git/docs/git-config.html[Git configuration] parameter 'receive.denyNonFastForwards' to +'false'). Then it is possible to push a non-fast forward update by +using the '--force' option. + + +GERRIT +------ +Part of link:error-messages.html[Gerrit Error Messages]