DEV Community

Discussion on: Git [Script] Aliases That Could Be Helpful

Collapse
 
maxgoldst profile image
Max Goldstein

Please, please use git push --force-with-lease instead of -f or --force.

Like all things git, the naming (a lease?) is a bit wonky. But basically, it will only do the forcing behavior when your local copy of the remote (e.g. GitHub) is up to date. It will refuse to overwrite commits that you haven't seen. This is much safer.