Added explanation for "non-fast forward" error
Added a documentation page that explains the "non-fast forward" error and what can be done to solve the problem. Change-Id: I5b4fafa847036ed5ffe73e81d4d0faf6add81a11 Signed-off-by: Edwin Kempin <edwin.kempin@gmail.com>
This commit is contained in:
		@@ -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 ...]
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										56
									
								
								Documentation/error-non-fast-forward.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								Documentation/error-non-fast-forward.txt
									
									
									
									
									
										Normal file
									
								
							@@ -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]
 | 
			
		||||
		Reference in New Issue
	
	Block a user