|
|
|
|
|
by Rusky
5630 days ago
|
|
The difference is not fundamental, no. It is a difference in philosophy and interface that discourages modifying history. 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. |
|
Because:
a) It's not a stable branch. It's my dev branch on my local box that nobody else can see.
b) I feel like it and there's no penalty. I can go back if something is wrong.
c) The next thing I'm going to do is risky. I should save where I am just in case I'm wrong.
> Why would you want to eliminate a state where you made something that worked?
Because it may not be meaningful and it may not work. In the above case, what value do you gain from the three revisions of that change that were incorrect? When it hit code review, there were problems with it. We fixed them. Why would you publish code that is known to be incorrect (since we figured that out during code review)?
> I don't see the appeal in modifying history.
I don't see the appeal in a history full of "Oops, I forgot to add this file to the last commit," and "build fix" and "The author wrote this on Solaris, but I need a small change in the Makefile for Linux."
If there's one logical change, having several commits where you just didn't get it right only adds confusion.
> If you just need to save some partially working state, etc. you can use patch queues- They make much more sense here.
Are you saying that because that's the tool you were offered or because you actually believe it's the best way to do things?
I used mercurial very extensively before I started using git (which I have also used very extensively). Most of my time was spent in mq capturing state of work in progress. That really sucked.
Now, I just commit whenever I feel like it, and then before I publish code, I update the commit messages, squash distinct changes that represent a single logical change that shouldn't be broken up, break up commits that represent more than one logical change that shouldn't be lumped together and just generally tidy things up so the reviewers and future developers tracking back bugs can make sense of things.
Then I test it: http://dustin.github.com/2010/03/28/git-test-sequence.html