3 ms·
Teaching new users about "--force-with-lease" may pay dividends over the less considerate "--force": https://git-scm.com/docs/git-push#Documentation/git-push.tx
by mdaniel 5y ago
Teaching new users about "--force-with-lease" may pay dividends over the less considerate "--force": https://git-scm.com/docs/git-push#Documentation/git-push.txt---no-force-with-lease https://git-scm.com/docs/git-push#Documentation/git-push.txt...
That is to say: I totally benefit from "git commit --amend && git push --force-with-lease" but 100% percent of the time want that flow to call time-out if someone has pushed before me
- pm215 5y agoUnfortunately as UI a 7 character option is almost always going to win over an 18 character option. I know about --force-with-lease, I know that it would provide an extra safety guard, and I always use --force anyway because it's the short, easy to remember and quick to type one.
- bdcravens 5y agoYou can of course create a git alias https://stackoverflow.com/questions/30542491/push-force-with-lease-by-default https://stackoverflow.com/questions/30542491/push-force-with...
- na85 5y agoUsing a modern shell like zsh allows for tab completion of those options.
- sitzkrieg 5y agogit push <upstream> +branchname is shorthand
- morris082 5y agoCheck out --force-if-includes … it works well in combo with —-force-with-lease and ensures you don’t accidentally replace a branch that is not yet merged into your current branch (force-with-lease has a pitfall where if you fetch before pushing, it’ll act like a straight up force push).