Learning Git, the quintessential version control tool, can be hard, but it's easy to form bad habits. Let's break bad habits and develop better practices.
Sometimes git-bisect is the right tool, and if you don’t have any familiarity with it, you might not use it when you should. Here are two strategies I’ve found helpful.
--force-with-lease checks that the remote branch is in the state that we expect. If there are upstream changes your local repository doesn't know about, the push will be rejected.
Reduce merge conflicts & improve collaboration with a minimal git branching approach – 4 pragmatic git strategies to help you spend more time writing code.
Avoiding lost code is one of the major benefits of version control, so using Git features that might cause data loss should only be done with careful consideration.