TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Linus on keeping a clean git history (2009)

233 pointsby pushingbitsover 12 years ago

12 comments

lukevover 12 years ago
This highlights the only thing I don't like about Git. It's an immensely capable tool, but it gives no guidance regarding the <i>right</i> way to do things.<p>Our own teams have a set of practices which are similar but different from what Linus outlines here. And different projects on my company use different practices from those.<p>The worst thing is that there's no way of enforcing these workflows or practices other than out-of-band social conventions. And so minor mistakes happen, all the time. Our Git projects are never as pretty as they should be.<p>In other words, Git provides an awesome set of primitives for source control. I'm not sure what it'd look like, but I'd like to see a product that built on those primitives to enforce a little more order on projects.
评论 #4612587 未加载
评论 #4612667 未加载
评论 #4612950 未加载
评论 #4613381 未加载
评论 #4613074 未加载
评论 #4613514 未加载
评论 #4612599 未加载
评论 #4613147 未加载
评论 #4612658 未加载
评论 #4613322 未加载
评论 #4612602 未加载
评论 #4617499 未加载
评论 #4613134 未加载
mattdeboardover 12 years ago
Like lukev said, git is "an awesome set of primitives". How you build a workflow out of those primitives isn't set in stone (though, like most things, Linus has strong opinions on exactly how to use his products). This is basically what Github has done, with an extra layer of UI glitz, social, and (much-improved) notifications.<p>That said, IMO there is still quite a lot of room for customization in git workflow when using Github. For example, we don't "send patches around" as Linus says. Our private feature branches live on Github but we've adopted the convention that the "private" branch name is prefixed by who's working on it, e.g. mdeboard-oauth, jschmoe-url-routes. If it has someone's name at the front, don't touch it. That enables us to still use the "D" in DVCS while retaining the ability to safely rebase our own work to keep our history clean.<p>The only reason I'd want a git-based product to "enforce order" is a culture-related one: ensure that contributors/collaborators do things in line with the conventions we've established. However, IMO it's always better to have a conversation about that than work with an overly prescriptive tool.
silverlakeover 12 years ago
I'm still new-ish to git and don't get why rebase is popular. If I do my work on a branch B, I can merge this branch into the master M. The merge point will have a succinct message "Bug Fix #1". You can print the history so it only shows these merge messages and not the messy history in the branches. Isn't this the same as rebase? That is, rebase <i>removes</i> the messy branch history. But I'd prefer to keep that history, but rarely use or display it. bisect can also ignore those branches and only use the merge points. Saving the branch history shouldn't be problem. What am I missing?
评论 #4613101 未加载
评论 #4612907 未加载
评论 #4612850 未加载
评论 #4613177 未加载
smithzvkover 12 years ago
So I'm relatively new to version control entirely, but in the last few years my group has been making a big push to institute Git. I have been wondering lately, however: how much history cleaning is expected/desirable?<p>When I develop, I split my commits into as many small changes as I can so that the commit messages are single topic. I thought that was basically the idea. Every once in a while I use rebase to combine a few commits that should have been done together as they all addressed the same issue. This all seems right to me. I am left with a clean history of everything I have done on a very fine grained time scale. But the large number of commits, each with little significance to whole program hides the large scale structure of the development.<p>However, I could use rebase to start combining loosely related commits, trading the time resolution for clarity in the commit history. There seems to be a continuum along this scale. Where is the proper place in that continuum to say this is clean enough? Also, I don't like making changes where I am losing perfectly good information.<p>I know that I can group certain commits by defining a branch, developing on it, then merging (non-fast-forward) back to the original. The branch should keep the grouping in the commit history. I even suppose that this is can be done after the fact using rebase with the proper amount of git-fu. Is branching and non-fast-forward merges the preferred method of grouping related commits in the history?<p>If so, this seems troubling as it means that partially fixing something is difficult to do with a clean history. Until the piece of the program you wish to fix is completely working, it shouldn't be merged into master because it would ruin the grouping of the related commits. This means that there can't be any partial thought's like fixing bugs as you find them, because presumably you might want to group all bug fixes of a function together, but have a distinct commit for each.<p>Now I'm more confused than when I started. Seriously, any references or advice on this sort of topic are welcome.
评论 #4613237 未加载
评论 #4613213 未加载
评论 #4613255 未加载
easy_riderover 12 years ago
Funny. I was just finishing a chat with a colleague about a git strategy for a coming new release of a production product, then saw this post on top. I've been working on it without collaboration for about half a year now, so thats easy.. I've had mixed experience with both rebasing and pull strategies before that. I've found rebasing being a lot better when working with tightly coupled code. And pull being a lot cleaner in being able to cherry-pick and revert to previous states more easily. rebase is indeed a destroyer.<p>We've now decided to use this model, while only deleting feature branches after RC acceptance.<p><a href="http://nvie.com/posts/a-successful-git-branching-model/" rel="nofollow">http://nvie.com/posts/a-successful-git-branching-model/</a><p>My colleague just suggested to rebase regularly from the develop branch while developing features "I'm working on a branch. someone - e.g. you - updates the develop branch. I will have no info if that is related to my stuff or not so, I should rebase regularly to the latest version of the develop branch"<p>I'm kinda clueless now. Git is really powerful and flexible in strageties, and that adds to complexity.
leeoniyaover 12 years ago
here's a more recent rant: <a href="https://github.com/torvalds/linux/pull/17#issuecomment-5659933" rel="nofollow">https://github.com/torvalds/linux/pull/17#issuecomment-56599...</a>
jrochkind1over 12 years ago
oh yeah, perfectly straightforward, only took several thousand words to confusingly explain.<p>Nope, not simple. Yep, this is a git usability problem.<p>In the ruby/github world, people generally violate this and DO rewrite 'public' history in order to get 'cleanness', primarily because almost ALL history is 'public', since you tend to show people work in progress on github, or just push it there to have a reliable copy in the cloud. And yes, this sometimes leads to madness.
chris_wotover 12 years ago
Unintentional contradiction two messages down the thread: Linus says "But note: none of these rules should be absolutely black-and-white. Nothing in life ever is."<p>Or perhaps intentional. I can never tell when I read a Linus fiat.<p><a href="http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39094.html" rel="nofollow">http://www.mail-archive.com/dri-devel@lists.sourceforge.net/...</a>
mibbitierover 12 years ago
git is so overly complex (Coming from svn).
评论 #4613115 未加载
评论 #4612914 未加载
评论 #4613095 未加载
gosubover 12 years ago
git needs a "git propaganda" command. Instead of changing history, it would tell it in a different manner.
3825over 12 years ago
I've heard some of these words...
jebblueover 12 years ago
I have tried to get git, some people say one project per repo (which seems crazy but I did it), many projects are ok, you do need a main master repo, you don't need one, then there's the half dozen commands where with SVN it's one.<p>Now the most valuable thing to me in source control, history, I'm supposed to keep clean? That's like a sacred cow, you _don't_ mess with history.<p>&#62;&#62; That's fairly straightforward, no?<p>No _Linus_ it isn't. Git is hard to get right. If it wasn't for EGit I'd be lost. I tried Canonical's bzr and it is more understandable for ordinary humans.<p>All that aside I really like Linux. :)
评论 #4618003 未加载