Reputation: 12476
From the Git documentation:
By default, the configuration flag receive.denyNonFastForwards is enabled in shared repositories, so that you cannot force a non fast-forwarding push into it.
I know about the git push
command, but what is fast-forwarding push?
Upvotes: 8
Views: 12242
Reputation: 25373
Basically, this means that you won't be rewriting commit history that already exists on your Git server (the already-pushed stuff).
If this history changes it could be a problem for others who have already pulled and worked off that history.
A manual way to determine if you are pushing "fast forward" is to look at what ref you have for your downloaded copy of your branches remote (let's say master):
git rev-parse origin/master # Returns SHA-1 hash value
Then, download the content from your remote server and check again:
git fetch
git rev-parse origin/master # Returns SHA-1 hash value
If the return result of those those two rev-parse commands are equal your push will be fast-forward.
**But... all that work really isn't necessary. Just simply pull before you push and you will be good.
git pull origin master
# Resolve any conflicts
git push origin master
Upvotes: 5