217
+
218
"--no-force-with-lease" will cancel all the previous --force-with-lease on the
219
command line.
220
++
221
+A general note on safety: supplying this option without an expected
222
+value, i.e. as `--force-with-lease` or `--force-with-lease=<refname>`
223
+interacts very badly with anything that implicitly runs `git fetch` on
224
+the remote to be pushed to in the background, e.g. `git fetch origin`
225
+on your repository in a cronjob.
226
++
227
+The protection it offers over `--force` is ensuring that subsequent
228
+changes your work wasn't based on aren't clobbered, but this is
229
+trivially defeated if some background process is updating refs in the
230
+background. We don't have anything except the remote tracking info to
231
+go by as a heuristic for refs you're expected to have seen & are
232
+willing to clobber.
233
++
234
+If your editor or some other system is running `git fetch` in the
235
+background for you a way to mitigate this is to simply set up another
236
+remote:
237
++
238
+ git remote add origin-push $(git config remote.origin.url)
239
+ git fetch origin-push
240
++
241
+Now when the background process runs `git fetch origin` the references
242
+on `origin-push` won't be updated, and thus commands like:
243
++
244
+ git push --force-with-lease origin-push
245
++
246
+Will fail unless you manually run `git fetch origin-push`. This method
247
+is of course entirely defeated by something that runs `git fetch
248
+--all`, in that case you'd need to either disable it or do something
249
+more tedious like:
250
++
251
+ git fetch # update 'master' from remote
252
+ git tag base master # mark our base point
253
+ git rebase -i master # rewrite some commits
254
+ git push --force-with-lease=master:base master:master
255
++
256
+I.e. create a `base` tag for versions of the upstream code that you've
257
+seen and are willing to overwrite, then rewrite history, and finally
258
+force push changes to `master` if the remote version is still at
259
+`base`, regardless of what your local `remotes/origin/master` has been
260
+updated to in the background.
261
262
-f::
263
--force::