2 ms·
> force push The solution is simple: never use push --force. Without that, everything in git is recoverable.
by perryizgr8 6y ago
> force push
The solution is simple: never use push --force. Without that, everything in git is recoverable.
- lordgrenville 6y agoIs this a general rule? If so, I'd appreciate a suggested best practice for the following case: say I commit, push, then a while later fix some minor error and don't want it to be a separate commit (otherwise my commit history would get unmanageable). So I gc --amend and then gp --force. What would be the correct way to do this?
- perryizgr8 6y agoFor the specific thing you want, force push is the only way AFAIK. However, my argument is that you should let the commits reflect the true history of the code. Fix the minor error and explain it in the message.
- intelfx 6y agoThe downside of the "true history" approach, besides obvious aesthetic reasons, is that it precludes the use of such tools as `git bisect` and `git blame`.
- Waterluvian 6y agoSure. But it’s better to disable it upstream. Otherwise you get hotshots and people with bad habits joining your company and doing naughty things.