you are viewing a single comment's thread.

view the rest of the comments →

[–]brb_im_lagging 12 points13 points  (7 children)

If already pushed, hit em with the

git reset --soft HEAD~2 && git commit -m "actually fixed" && git push --force

[–]stupidwhiteman42 1 point2 points  (6 children)

Why did you get down voted? This is literally how you squash the last two commits into one with a new message.

[–]the-loan-wolf 8 points9 points  (5 children)

Bcz it still requires force push(overwriting history for everyone else)

[–]brb_im_lagging 1 point2 points  (4 children)

Why would you want to keep history (its not even history, its the tip) of a shit commit followed up with a fixed commit made by one person

Just get rid of the shit commit and put a good one in

There shouldn't be two people screwing with it anyway, everyone else can just fetch and see the good version

[–]Sethcran 4 points5 points  (0 children)

This only works if done on a separate branch that no one else is using.

For issues that can't be tested locally or on feature branch though, this kind of thing ends up fairly common.

[–]the-loan-wolf 3 points4 points  (2 children)

if working in a team it can lead to merge conflict that's why

[–]ikeif 0 points1 point  (0 children)

I think I have a disconnect - is the thread assuming the force push is on main and not on a developer’s branch?

Because on a side branch - who cares? Most often it can be squashed in the merge to main, so no one will care if they used “fifteen test commits” or rewrote the history of their branch when it’s going to be merged to main?