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.
Top comments (2)
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.
Thanks for clarifying