DEV Community

Discussion on: Git Concepts I Wish I Knew Years Ago

Collapse
 
darrylhodgins profile image
Darryl Hodgins

Careful now, git push -f requires that everyone on the team have as good an understanding of git as you do, particularly when dealing with shared branches like master.

We generally don't ever want to see rewriting history on shared branches, because once any other team member grabs the latest (fetch/pull), they're going to have to deal with branches that have diverged. It goes from being a problem for one dev, to being a problem for the whole team.

When others are involved, it's a much better practice to resolve the issue as a fast-forward or merge commit, then tack that on to the HEAD of the remote branch.

Collapse
 
g_abud profile image
Gabriel Abud

Agreed, I will probably add that as a warning. Good suggestion.