| This misconception always bothers me: "In Mercurial you can’t change previous committed code. In git you can change the past commits in the repo. I am sure there are cases where the linux kernel needs to do this (I can’t think of any), but this is some we don’t even want to have the option to do." Yes, you certainly can change commits in hg. The tools to do it in git are a bit more refined, but there's no fundamental difference here. I don't want every failed, unbuildable, safety-net commit making it into my project history. I want it to be possible for people to understand change. For example, here are the last few commits from my primary work project: http://pastebin.com/BiNpP08s In a week from now, will you need to see the four different attempts it took to get that last change right? If so, you can always follow the code review link and see the discussion that went on there and how it shaped into that file change, but anyone who makes actual good use of their project history will get frustrated pretty quickly at thought-free changes. |
The question is: Why would you commit (to a stable branch) when your code doesn't build or pass tests? Why would you want to eliminate a state where you made something that worked? I don't see the appeal in modifying history.
If you just need to save some partially working state, etc. you can use patch queues- They make much more sense here.