News for hackers. Stuff that matters.
Re:Ask HN: Google/FB engineers, Do you like Mercurial? by Fenume on Thursday May 07, 2015 @08:51AM (#9504642)
Why would you rewrite history? Don't be ashamed.
Re:Ask HN: Google/FB engineers, Do you like Mercurial? by allersj on Thursday May 07, 2015 @09:08AM (#9504737)
For me, I tend to commit frequently, sort of like my obsession with constantly hitting CTRL-S while working in an IDE. Before I push my changes I like to squash the commits into more cohesive commits. If anything, I think it makes it easier on my colleagues for code review.
Re:Ask HN: Google/FB engineers, Do you like Mercurial? by jordigh on Thursday May 07, 2015 @09:18AM (#9504798)
I do the same in hg. I do `hg amend` all the time to keep adding changes to my commit. At the end I may selectively undo some changes with `hg uncommit --interactive` or `hg uncommit --all` and redo the whole thing piecemeal with `hg commit --interactive` in order to slowly split up my work into several commits. Evolve makes it really easy to keep (and ignore!) a meta-history of all of my editions, with a clear lineage of which new commit replaced which prior commit.

I may also rebase my work onto the latest head at the end (not to be confused with git HEAD).

And all of this with a very nice interface. It's always --interactive, not sometimes --patch and sometimes --interactive.

Re:Ask HN: Google/FB engineers, Do you like Mercurial? by allersj on Thursday May 07, 2015 @04:55PM (#9508252)
Thanks, that is useful to know.

Mercurial was my first DCVS and I loved using it, but I only touched on the basic features. I stopped using it when I switched jobs and to become proficient with git. I'll have to give it another try with one of my side projects.

Re:Ask HN: Google/FB engineers, Do you like Mercurial? by limeyx on Thursday May 07, 2015 @04:00PM (#9507857)
Thats not the same kind of rewriting history because its local to you and hasn't yet been pushed out to others.

Git allows you to push commits to other people and then rewrite history, which is different

Re:Ask HN: Google/FB engineers, Do you like Mercurial? by allersj on Thursday May 07, 2015 @04:49PM (#9508205)
Ah, gotcha. Thanks for the clarification.

I knew that pushing a rewritten history was possible, but I can't think of any situation where I would ever want to do that.

Re:Ask HN: Google/FB engineers, Do you like Mercurial? by mpdehaan2 on Thursday May 07, 2015 @09:13AM (#9504761)
Re:Ask HN: Google/FB engineers, Do you like Mercurial? by leni536 on Thursday May 07, 2015 @09:29AM (#9504855)
No it's not, it rewrites and destroys history. The problem it solves is "keeping the history clean", when actually it's not what you want. You don't see your history, you see logs and diffs. So you want to keep your logs and diffs clean. There should be an other solution to this other than simply removing/merging commits and eventually removing information with it.
Re:Ask HN: Google/FB engineers, Do you like Mercurial? by brusch64 on Thursday May 07, 2015 @10:38AM (#9505332)
We had the same discussion in my office. If I am developing a feature (in a separate branch) - why shouldn't I rebase to make a single commit out of this feature ?

Is this really interesting for you that it took me 10 commits to do sO ? Even if one of the commits was just a "I have to switch an fix a bug and want to commit before switching to another branch" - commit ?

I think there is nothing wrong with rebasing and to merge commits before pusing them.

Re:Ask HN: Google/FB engineers, Do you like Mercurial? by leni536 on Thursday May 07, 2015 @12:28PM (#9506268)
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.

Re:Ask HN: Google/FB engineers, Do you like Mercurial? by thanksgiving on Sunday May 10, 2015 @12:09PM (#9520308)
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?
Re:Ask HN: Google/FB engineers, Do you like Mercurial? by brusch64 on Tuesday May 12, 2015 @07:35AM (#9530929)
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.
Re:Ask HN: Google/FB engineers, Do you like Mercurial? by mpdehaan2 on Friday May 08, 2015 @09:03AM (#9511384)
if you read my post, "history" on local branches is irrelevant. They do not exist and "destroy" here is totally fine. It's not like it's meant to be a grand book detailing all the work done by you, in every point in time, as a database record. What you want here instead is just a clean patch coming off your topic branch -- which this does perfectly.

This is SUPREMELY valuable for OSS patch workflow and I absolutely love git for having it.

Re:Ask HN: Google/FB engineers, Do you like Mercurial? by dajobat on Thursday May 07, 2015 @10:03AM (#9505090)
Some of the arguments against merging made in this article seem a little strange, for example saying "If folks on topic branches rebase, there will not be any conflicts on merge" after previously stating "It’s also a great idea to rebase periodically - several times a day", as there would also be no merge conflicts if the branch was merged in periodically as well. If merge commits are so abhorrent, just alias git log to git log --no-merges
Re:Ask HN: Google/FB engineers, Do you like Mercurial? by mpdehaan2 on Friday May 08, 2015 @09:05AM (#9511400)
Rebase is not just a history win, but also a patch review win.