5 ms·
I completely agree with this. If a change was worth committing then it is worth sharing that commit with everyone. Otherwise you run the very real risk of loo
by westi 15y ago
I completely agree with this.
If a change was worth committing then it is worth sharing that commit with everyone. Otherwise you run the very real risk of loosing important information about the design of a feature the bugs that were found and addressed during development.
Every change should been accompanied by a well described commit message and big changes are much harder to review.
I can see a very small positive in "hiding" the commits which resolve process issues like forgetting to add a file but in the long run you shouldn't have very many of these anyway so you should worry about them.
- pyre 15y ago> If a change was worth committing then it is worth > sharing that commit with everyone You're misunderstanding some of the workflows that people are discussing. Sometimes I commit things that are half-finished, or even half-baked because I know that when it comes time to push I can rewrite things into a set of commits that makes sense. This workflow makes sense because rewriting is easy enough. Obviously, I might not do this if I had to publish every commit that I made. But then I would just resort to using something like quilt to manage patches onto of SVN, which is ridiculous. You VCS is a patch management system. The idea that someone would use a patch management system on top of a patch management system suggests that something is broken (yes, I have had people on HN claim that git sucks because SVN + quilt 'work for me').
- westi 15y agoMy point is that these interim commits are useful information for other people too not just you. They help show how the feature developed, what other implementation ideas you tried along the way etc.
- chousuke 15y agoHow are they useful? Why would anyone care about how you developed a single bugfix or a feature? In your model, often the commits are not even sequential in the log because you might find a mistake only after committing several other changes. I can't see how not rebasing makes commit history better in any way at all. I would like to hear your reasoning. The way I see it, instead of a series of commits that implement something, you could have a single patch (commit) that implements something, making it much easier to 0) find all the code that implements a certain feature, because it's a self-contained commit, 1) find bugs via bisection, 2) port to other versions via cherry-picking and 3) read the changelog and figure out what the hell is actually happening because there are no trash commits around obscuring things. EDIT: Just to clarify, I do not think that this is a matter of opinion or preference. That would imply that both approaches are equally valid. I consider rebasing a tool that enables a vastly superior workflow. I have given a few reasons why I think it is superior and I am interested in counterarguments or at least reasoning as to why not making perfect commits (to the best of your ability) is preferable or even acceptable at all.
- westi 15y ago> How are they useful? Why would anyone care about how you developed a single bugfix or a feature? In my opinion in a collaborative environment it is immensely useful to know about how a feature / bug fix was developed. Hiding away the development of a feature into one large commit makes it harder for people to review. > I do not think that this is a matter of opinion or preference. That would imply that both approaches are equally valid. I think it is a matter of preference and opinion and this is why we have such diametrically opposed views on the subject.
- pilif 15y ago>In my opinion in a collaborative environment it is immensely >useful to know about how a feature / bug fix was developed. > >Hiding away the development of a feature into one large >commit makes it harder for people to review. this is exactly what be pro-rebasers were talking about. Nobody of us wants to do one big huge commit that contains the whole feature. Everybody of us wants small, self-contained commits, every commit fixing or adding one specific thing. What we don't want is a commit adding a thing, quickly followed by another commit "forgot to add this file", because that later commit provides no value to a reviewer. What we rebasers are talking about is forging the history in a way that a patch reviewer can go over every single commit and, in one glance, decide whether that patch makes sense or not. Let's assume it's the old days of svn: A whole file is the smallest unit of change you can commit and there's no way to change history. Let's further assume that you want to add a new feature to a file. While doing so, you also notice that there's a bug in another part of that code in the same file that became apparent while writing your feature. Your feature only works with the bug fixed, but the bug fix also makes sense independently of the feature. In the old days, when committing that file, you have two options for commit messages: 1) "adding feature foobar" leaving out the fact that you also fixed a bug. This is bad if your bugfix contains another bug and I have to dig in the history, wondering why you changed this seemingly unrelated piece of code. If I have to review the code, I will have to ask you, why you also changed a seeminly unrelated piece of code. 2) "adding feature foobar and fixing bug bar" this is better, but weren't you thought that a commit should only do one thing? This clearly does two. At that point, you could use diff, patch and an editor to remove the feature but leave the bugfix in. Then you commit that as "fixing bug bar", followed by more diff and patch to get the feature in, which you commit as "adding feature foobar". Fine, but very cumbersome, so hardly ever done. Git, on the other hand, with the help of "add -p" and "rebase -i" makes exactly this possible and turns something incredibly painful into something you can do with closed eyes in your sleep. And this is why there is this vocal pro-rebasing-crowd. We EXACTLY NOT talking about mushing everything together in a big commit We are talking about creating MANY, MANY more SMALLER commits that are independent of each other and thus much more maintainable. Case in point: Since we migrated to git for our product and since everybody learned about rebase and began using it, we made the same amount of commits in one year that we did in tree previous years. I would be seriously upset if somebody used the power of rebase to create big huge commits and wanted to push them to our main repo. This is not what we are advocating rebase use for. Not at all.
- pyre 15y agoPersonally, I think that this idea of somewhat bogus: 1) In most cases, all of those extra commits are just noise. They make it really confusing to determine what actually changed from point A to point B because of all of the dead ends that were hit and backed out in between. 2) This is like saying that every time that someone produces anything they should be required to save all of their dead ends for people that look at their work in the future. If a carpenter at a building site cuts a piece of wood wrong, should he just recut it correctly, or set it aside so that on the off-chance that someone needs to see how he mis-cut the piece of wood, they can? 3) The fundamental flaw here is that you're trying to use the tool to enforce the workflow. Would you feel the same way if the next version of Ubuntu enforced that no image files could be placed anywhere on disk except ~/Photos just because someone determined that that's what 'makes sense?'
- baha_man 15y ago"But then I would just resort to using something like quilt to manage patches onto of SVN, which is ridiculous." This is exactly the way Mercurial patch queues work: http://mercurial.selenic.com/wiki/MqExtension http://mercurial.selenic.com/wiki/MqExtension