Undoing a commit that is already pushed

Back to list2024-10-20
You

I pushed a bad commit to a shared branch. Reset or revert?

ChatGPT

Revert. It creates a new commit that undoes the change and leaves everyone else's history intact. Reset plus force push rewrites what others have already pulled, which turns your small mistake into everyone's afternoon.

You

Does rebasing actually help with two people?

ChatGPT

Marginally. The real value of rebase is a readable history when many branches land per day. With two people the cost of the occasional botched rebase usually exceeds the benefit, so merge and squash on the way in is a calmer default.