Hacker News new | ask | show | jobs
by leni536 4055 days ago
I don't think it's wrong when using git. However I think it shouldn't be designed like this though. Git rebase should add metadata not remove them. Essentially you rebase because you want to hide certain details because they are not important. Rebase could do one or more actual merges instead and mark certain commits not important so they wouldn't show up in logs by default.

AFAIK rebase is the only operation that happily destroys your history without any --force or --hard option. It always disturbed me.

There is a legitimate usage of rebase though: you really want something removed from history. Like you accidentally committed a secret, inappropriate message or you just want to fix a typo in the last commit.

1 comments

The way I understand it, I should only rebase (for squashing, not in the case of a spilled secret or inappropriate message) if I haven't pushed it to a shared remote branch. Is that correct?
That's how I am using rebase all the time. I'd say yes - that's the most common use for it and I think it works fine for this.