Number945
Number945

Reputation: 4940

Difference between git push --force vs git push non fast forward update

Let us say I run

git push --force origin master:master (forced update)

and at another place

git push origin +master:master (Non fast forward update)

Are these 2 same ? Any scenario where these 2 behave differently ?

Upvotes: 3

Views: 150

Answers (1)

Thomas
Thomas

Reputation: 181705

They are identical. From the docs:

All of the rules described above about what’s not allowed as an update can be overridden by adding an the optional leading + to a refspec (or using --force command line option).

However, and perhaps obviously, --force applies to everything that's being pushed, whereas + applies to only that refspec prefixed with the + (master in this case). In the two commands in your question, that doesn't make a difference because there is only one refspec in both of them.

Upvotes: 4

Related Questions