21 ms·
What’s wrong with Git? A conceptual design analysis
- bsandert 10y agoGit only started really clicking with me when I started thinking of most of my actions as graph building and traversals. It also helps to realize that for most intents and purposes, commits in git are immutable and "destructive" actions such as rebase don't _actually_ rewrite history, but rather create a new path in the graph and moves your branch pointer to it, leaving all previous commits intact (though potentially hard to reach and subject to garbage collection).
- Ericson2314 10y agoFrom a very quick read, yet another UI takedown without mention of underlying content-adressable arch. As it turns out I do think both the porcelain and plumbing commands both suck, but I rather read a takedown by somebody who's learned all the layers.
- develop7 10y ago> yet another UI takedown without mention of underlying content-adressable arch I'm wondering how nice architecture under the hood can be an excuse to have an Boeing-747-cockpit-style UI?
- detaro 10y agorecent discussion of the gitless project, which is presented as in this paper: https://news.ycombinator.com/item?id=12621837 https://news.ycombinator.com/item?id=12621837 (300+ comments)
- xedrac 10y agoI personally think Git's staging concept is one of its best features. Yes it is different and increases the learning curve somewhat, but it also provides a lot of flexibility in what you commit. For anyone that thinks Git is too complicated, consider using Mercurial.
- JoshTriplett 10y agoIn particular, the staging area goes hand-in-hand with making small, consistent commits containing one logical semantic change each. I find it much harder to do that without the staging area. (I attempted to follow that practice all the way back to CVS and SVN, but found it challenging to do so.)
- Ace17 10y agoIf my repo contains modifications I don't want to commit, I git-stash those modifications. I find it to be a lot safer: at least I can run the build + testsuite on what I'm actually going to commit, allowing the prevention of an incomplete commit (which means in practice, I nearly always use "git commit -a", and I find the index pretty annoying).
- caf 10y agoIt'd be nice if there was a way to run a build + test cycle on the staging tree.
- glandium 10y agoYou can use git stash -k Which will create the stash with your changes (both staged and unstaged), but keep the staged ones in the staging area and in the working tree. https://github.com/git/git/blob/659889482ac63411daea38b2c3d127842ea04e4d/Documentation/git-stash.txt#L239 https://github.com/git/git/blob/659889482ac63411daea38b2c3d1...
- tomp 10y agoHaw can you partially stash a file?
- glandium 10y agogit stash -p
- mahidhar 10y agoAgreed. One of the common things I use is git add --patch <file>. This allows me to commit changes in a file under different commits, by staging only the parts of the file that I consider as relevant for that commit. A lot of times I have different conceptual ideas in the same file, and I would have either forgotten to commit them during the day, and only realize it in the evening when it's time to push the code upstream; or those features would have been developed in parallel, because they are codependent, but are not necessarily the same from a conceptual point of view to the project. Either way I would want them under different commits so that my commit log is clean, and each commit can stand on it's own. This is where the --patch flag and the staging area are really useful. It might be a little trickier than just committing all tracked files with changes, but I appreciate the control. However, I do sympathize and agree with some of the points raised in the article, and I think there's definitely a scope for better interface design in git. For example, the stash is something that regularly confuses me, and the solution in the article seems like a better interface.
- marcv81 10y agoTL;DR: author blames his lack of understanding of the git concepts rather than the git concepts themselves.
- pcwalton 10y agoThe author clearly understands the git concepts.
- gcp 10y agoMost git users commenting on the other hand seem unable to grasp that partial commits and staging areas are different concepts.
- graememcc 10y agoThe blog is called "The Morning Paper". Each article aims to summarise an academic paper, and the paper in question is linked in the first paragraph. The article content doesn't necessarily represent the author's own opinions or their understanding.
- mooted1 10y agoMost of the comments here are missing the point. The functionality and architecture of git aren't what's being criticized, but the way this functionality is presented. In fact, gitless if built on top of git's architecture. As far as I can tell, gitless still embraces git's distributed and incremental core. It just packages it in a way that's easier to digest. If you're a veteran and know your way around native git flawlessly, gitless probably presents little value. But if you're a notice just learning the tool, gitless can probably accelerate your learning curve without sacrificing functionality—you can still bypass gitless's abstraction layer when you need it.
- gcp 10y agoI'm not sure that combining stashes and branches wouldn't be handy for advanced users either.
- glandium 10y agoI'm not sure I'd know what name to give to my countless stashes.
- Pxtl 10y agoLet the system provide default names for them, based on the name of the branch they came from.
- petre 10y agoWhy would I commit my breaking, work in progress experiments to a branch? Isn't that what stashes are for?
- aninhumer 10y agoBecause sometimes stashes are longer lived than we expect, and they're hard to work with if you need to do anything more complicated than popping. (Like resolving conflicts.) I find that making a work-in-progress commit, and then resetting later ends up saving a lot of hassle overall. Having support for this beyond aliases (including putting that commit in a new branch) would be nice.
- initram 10y agoThis is a really cogent description of what I've felt about fit for a while but was unable to articulate. It's also written in an non-combative way.
- wirrbel 10y agoThe interesting thing about git is, that while it is heavily criticised for begin difficult, it is such a huge success. Most of the time, criticism of git can be summarized as "Bad user experience", which is often blamed on git exposing its implementation details. I.e. most git criticism proposes that the backend of the VCS should be "private" and the user should see a carefully designed UI, that is optimized for workflows. I think we don't need to redesign git in such a way, for the mere fact, that we already have a mature, distributed version control system that has a carefully designed UI and has a core that is opaque to the user: mercurial In fact, given mercurial's age, the availability of github-like hosting services (bitbucket offered mercurial hosting for years) raise a very important question, that I would like "git-reformists" to answer as part of their critique: Why has git won more market share than mercurial? My feeling is, that part of what makes git hard to new users is a "killer feature" for intermediate and advanced users. I.e. having a basic understanding of how git manages its data makes hardly leaves me with situations and repository states that I cannot resolve. Whereas in mercurial, I feel pretty much lost when I want to do something that has not been an implemented workflow. Maybe, now that we know a lot more about DVCS workflows than we did at the time when mercurial and git were young, a new workflow-oriented VCS might make better workflow choices. Until then, I happily stay with git.
- pjmlp 10y ago> Why has git won more market share than mercurial? Because Git is used by Linux and was designed by Linus. Those facts alone are good enough for most people to choose git over something else, not the technical ones. Just like UNIX and JavaScript, technically better is not always what wins.
- jogjayr 10y ago> the elimination of staged versions; So you can't selectively stage hunks and discard others? Or stash them after making a commit of the ones you staged? > the elimination of the concept of Stash, and stashed versions; This eliminates the possibility of quickly putting away work in progress to do an impromptu demo at your desk, or answer a co-worker's question about the current master, or (for git newbies) working effectively with git-svn (in companies where SVN is used) without needing to learn about local branching or rebasing. > Thus, it is as if there are multiple working directories (one for each branch), So...like Subversion? Ew. Does git have sharp edges? Absolutely. It's a tool meant to be used by professionals (or skilled hobbyists) to do work and build things. I'm all for making things simpler to use, but putting training wheels (or guardrails) on a product meant for an expert user seems...counter-productive to me. To me it's like saying "Gee that cockpit has an awful lot of dials and instruments and things, we could probably take out a lot of the complexity if we assume that pilots will never have to deal with a stall" (I know nothing about planes) I am also willing to admit that perhaps I'm too wedded to the time investment I've put into learning git and therefore assume that anything that attempts to make git simpler is flawed in some way. Maybe gitless really is the future of git.
- gcp 10y agoSo you can't selectively stage hunks and discard others? As other people have pointed out, most new version control tools can do this without a staging area. This eliminates the possibility of quickly putting away work in progress to do an impromptu demo at your desk, No it doesn't, and they explain how. With combined branches + stashes, you'd do a checkout of a new branch from the commit before your stashed changes. So...like Subversion? ... putting training wheels (or guardrails) on a product meant for an expert user seems...counter-productive to me. Did you even read the article or the original paper?
- marcinkuzminski 10y agoThe latests iteration of hg crecord which is an interactive selection tool for chunks (see it in action here: http://g.recordit.co/BfbSa7cMXn.gif http://g.recordit.co/BfbSa7cMXn.gif) Is far far better than git staging area. Intuitive to use, i can submit hours of code in few nice selective chunks really easy. This sole function built in is a game-changer in mercurial for me.
- FuNe 10y agoThis reminds me of a well known comic: https://xkcd.com/1597/ https://xkcd.com/1597/
- kinkdr 10y agoThats really funny, because that's exactly how I use git. But I only blame myself for never finding time to read up a bit and understand its concepts.
- deleted 10y ago[deleted]
- chmike 10y agoThis presentation of gitless makes it attractive. I'll give it a try. One of my problem for which I didn't find a satisfying solution yet is to efficiently see the changes in commits and reshuffle and merge them. Actually, when I do a change, I offten see and fix typos and other bugs or refactor code in the same step. So my commits tend to be a compilation of unrelated changes instead of clean atomic commits. It is a boring work to split these commits into nice and clean commits. I know I should commit frequently (small changes), and then afterward merge related commits. But that is not easy with git and I suppose gitless too. So I tend to do big commits which is bad. Any suggestion how I could improve my commits ?
- aninhumer 10y agoThis might already be what you're using, but just case (and for other people's benefit) `git rebase -i` is very helpful for reordering and combining a bunch of small commits. (I mention it because you're referring to "merging" rather than squashing or fixups.) It opens a text file listing your commits prefixed with a command, which you can reorder and edit to change the history in one go. It's not completely painless, and I still prefer to do operations one at a time with it in case there are any conflicts, but it's still better than the alternative. (I'm not even sure what I do instead...)
- chmike 10y agoThanks. I saw that gitless has the option -p that is documented as allowing to select parts of a file to commit. I'm curious to test that. It seam possible to reshuffle commits using `gl fuse` which is a kind of `git rebase`, but there is no interactive mode as with rebase. Just found a limitation in gitless. I can't publish tags.
- Tobu 10y agoThe blog author doesn't understand Git that well: git add foo.rb // continue working in foo.rb git commit foo.rb will commit the latest version of foo.rb. That's because git commit handles its arguments by add-ing them to the index (staging area) before doing the actual committing. I'm not so sure about the conceptual graph from the paper, either. The stash is a commit, it doesn't have anything to do with file states.
- aninhumer 10y agoNo, the author is correct. The add command adds that version of the file to staging, so subsequent changes will need to be added as well if you want them in the commit.
- deleted 10y ago[deleted]
- nickez 10y agoNo, you can read the following in the man page of git commit: 3. by listing files as arguments to the commit command, in which case the commit will ignore changes staged in the index, and instead record the current content of the listed files (which must already be known to Git);
- aninhumer 10y agoOh indeed, you're right. This didn't occur to me because I've never had a reason to use `git commit [path]`. And I don't know if I'd call this error evidence of the author not understanding git, as much as I'd call it further evidence of the inconsistency they're highlighting.
- glandium 10y ago> That's because git commit handles its arguments by add-ing them to the index (staging area) before doing the actual committing. That's not what it actually does. It commits all the changes from the file (staged or otherwise), and nothing else. It leaves the index/staging area in the same state, except for the committed file. That is: git add foo bar baz git commit foo will commit any change to foo, and leave bar and baz alone (staged and non staged parts).
- Lazare 10y agoThe issue here is that git is: 1) A tool for managing collaborative work through a beautiful distributed graph theory tree model[1]... 2) ...with a very, very difficult to use UI. Unfortunately: 3) A good, intuitive UI for manipulating the underlying model without ignoring edge cases or removing functionality is extremely difficult, and indeed, nobody has done it yet. So you periodically see these articles pop up decrying the UI, but nobody ever makes a great UI that wraps the underlying tools. This article talks positively about gitless, and it's a great tool, but it gets a good UX only be hiding/disabling large chunks of functionality. And like most tools... 4) Git suffers heavily from the 80/20 rule[2]. I'd say 95% of the time, I'm using maybe 5% of git's features. But the other 5% of the time, I'm using another 1% of git's features but it's always a different 1%. I might go weeks without needing to cherry pick a commit, but when I need to, I really need to...and gitless doesn't support it (or most other "complicated" features). But the reason git beat out the competition isn't git's excellent UI or large marketing budget, it's that those features actually provide significant value. And so we get a slow drip of articles like this. "Man, it would be nice if there was a better git UI that had all its features!" It would indeed. [1]: https://xkcd.com/1597/ https://xkcd.com/1597/ [2]: http://www.joelonsoftware.com/items/2006/12/09.html http://www.joelonsoftware.com/items/2006/12/09.html
- glandium 10y ago> But the reason git beat out the competition isn't git's excellent UI or large marketing budget, it's that those features actually provide significant value. I don't know if it's true for everyone, but this is at least true for me. The reason I started to work on a git remote helper to talk to mercurial servers is that I grew frustrated that mercurial didn't have some of those features (and that the existing git remote helpers were not working well at the scale of mozilla-central, or required a local mercurial clone under the hood)
- jbergens 10y agoAnd funnily enough mercurial is today the most scalable of the two. As an example Facebook uses it for it's monorepository. Not sure about the scalability of of git-helpers though. What features were you missing, by the way? Mercurial has had rebase, squash and light branches (bookmarks) for many years now. I personally don't miss staging if I use it.
- mrmondo 10y agoJust my IMO - takes a bit to learn the basics but it's good enough, move on to more important problems such as privacy, security etc...
- Sir_Cmpwn 10y agoThe "problem" with git, imo, is that it's designed for hackers more so than professionals. Most people simply don't grok that. As someone with a background in Linux (for which it was designed, not the trendy "hacker" OSes like OS X), as someone who's willing to dig in and understand the internals, I find it beautiful. If I made a VCS from scratch it would end up being pretty similar to git.
- matt4077 10y agoThe problem with so-called "professionals" is that they sometimes, when their egos are running a bit dry, they feel the need to dismiss others as "hackers" or "hobbyists" or "amateurs" or "hipsters". It's mostly a problem for them though, because it makes them an easy mark. You can get them to spend a significant chunk of their time on earth patching kernels to get their ethernet cards working, and they'll gladly do it and feel really quite manly and professional and not lonely at all, no.
- Sir_Cmpwn 10y agoI'm not dismissing anyone in the way you think. I'm not passing negative judgement on the people I'm talking about - I just don't think they're hackers. I don't think they couldn't become them, either. What I'm saying is this: git is easier to understand with the context you have from being the kind of hacker I'm talking about. People only ever written rails or node from the comfort of Atom and their four favorite shell commands simply don't have the experience to easily understand why git works the way it does. That's not an inherently bad thing, but it does make git more difficult to understand.
- jgalt212 10y agoI feel about git the same way I feel about emacs. In the time it takes to master git/emacs, one could have accomplished something seriously impressive. Of course, this analogy doesn't completely hold because the basic functionality of git is pretty easy to use (especially with gui tools).
- meira 10y agoI suggest using a more commercial tool, like Microsoft Visual Source Safe. There is nothing wrong with Git (at least not at conceptual design level, or it would not have become one of most successful piece of software of all times - like top3, alongside with Linux, another masterpiece of the same creator).
- j_s 10y agoMicrosoft Visual Source Safe Maybe Perforce or something, but recommending VSS in 2016? Hope it works out for you! http://www.highprogrammer.com/alan/windev/sourcesafe.html http://www.highprogrammer.com/alan/windev/sourcesafe.html
- FloNeu 10y agoJust some git love Didn't read, but there are so many articles out there... i started working with git from console ( when i didn't use the console that much ) and still compared to tfs, subversion etc. it felt like haven. I currently have to use SourceTree at Work... damn it makes git feel so slow... Somebody experience with https://www.gitkraken.com/ https://www.gitkraken.com/? Any point in trying it out? All the best
- msimpson 10y agoWhile Gitless is a positive effort to rectify some of the shortcomings of Git, I wonder why the authors found it necessary to construct a veneer over Git instead of simply forking it entirely. While the veneer is nice on a trial basis of such functionality, to continue in that fashion for production use would require constant maintenance to remain in sync with any core changes to Git and its surrounding tool chain. A fork would be cleaner, yet interoperable with Git repositories and separate.