Re:Better Git configuration
by dilap on Thursday April 06, 2017 @01:28PM
(#14052633)
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.
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.)