Hacker News new | ask | show | jobs
by jzm2k 957 days ago
git-rebase is stupid because somebody doesn't know how to use it?

I use it all the time and I really like how I can make garbage commits (wip, test) and then squash them into atomic commits which are easy to review and later on easy to bisect when inevitably mistakes happen. Sure I've fucked up too when I was learning on how to use it and those were some painful mistakes but only through using it and making those mistakes have I learned to use the tool to great advantage (clean history).

3 comments

> git-rebase is stupid because somebody doesn't know how to use it?

The whole purpose of source control is to reliably track code changes so you don't lose anything and can revert to any point or recover from bad merges. Since rebase permits you to violate this core purpose and literally lose the entire history of code changes, then yes, it is stupid.

It doesn't. Reflog still exists.
No. Reflog exists locally.

Getting away from dependence on the ephemeral is why git exists.

Git rebase is also local.
The trouble with git rebase is that it can create havoc by those who don't understand what it is doing conceptually, and (probably more importantly) how to recover when things go wrong.

When I hear people griping about rebase, I assume that nobody took the time to teach them how to use reflog first. Once I had an understanding of reflog, I could mess up all I wanted (without pushing) and recover. In that environment, rebase can become a very useful tool. Without being able to recover, rebase becomes a tool of confusing irreversible destruction.

> git-rebase is stupid because somebody doesn't know how to use it?

No, it's stupid because it's really common for people to fuck it up, and because the purported benefits (clean history) are not something which matters.

If I tell you it matters to me, will that change your mind?

You've told me that it doesn't matter to you, but that hasn't changed my mind.

It's not a matter of objective truth, it's a preference.

Most of us are paid for working software, not the story of its creation. One is definitely more important than than the other.