3 ms·
Here's one: Use: git push --force-with-lease Instead of git push -f (Obviously ideally you'd never do either, but sometimes life happens.) The adva
by dilap 10y ago
Here's one: Use:
git push --force-with-lease
Instead of
git push -f
(Obviously ideally you'd never do either, but sometimes life happens.)
The advantage of the former over the latter is that it won't push if you haven't already seen the ref you're overwriting. It avoids the race condition of accidentally "push -f"ing over a commit you haven't seen.
(Why this isn't the default, I have no idea.)
- scrollaway 10y agoYes, force-with-lease is really useful. I set it up as an alias of git fpush, and have never used push --force since.