Git push force but less destructive
July, 2020
Sometimes we do not follow all best guidelines, creating new branches because there is a point that makes no sense if you have just typo in translation and you amend your last commit or you squash your commits, there will be no harm but in situations when you must work with a teammate on sam branch there is one safer solution than
git push --force
`--force-with-lease`
refuse to update a branch unless it is the state that we expect; i.e. nobody has updated the branch upstream
git push --force-with-lease
note: this is not a bulletproof solution but is still better than just using `--force`
here is a good article explaining it with potential pitfalls https://blog.developer.atlassian.com/force-with-lease/