DEV Community

Panda Quests
Panda Quests

Posted on

Is using git push --force bad practice?

Top comments (2)

Collapse
 
0916dhkim profile image
Danny Kim

In short, yes, it is a bad practice. Force modifying the git history can get your collaborators out of sync. Instead of modifying existing commits, prefer to make a new commit and do a non-force push. Force push is unnecessary most of the times.
There is one exception to this rule. If you are working alone on a feature branch, force pushing does not affect anyone on the main branch. So when you would like to rebase your feature branch or edit some commit messages, you can force push those modifications on your feature branch. No one gets out of sync, even after your feature branch is merged into the main branch.

Collapse
 
pandaquests profile image
Panda Quests

Thanks for clarifying