10 ms·
Purposes, Concepts, Misfits, and a Redesign of Git
- zokier 10y agoWhile I don't think git couldn't be improved, especially in terms of ux, I do feel like losing staging area altogether is quite significant sacrifice, like throwing the baby with the bathwater. The ability to build up and massage the commit in staging is really powerful method, and I think it makes git actually easier to learn once you get beyond the initial hump due its interactive nature.
- rspeer 10y agoAside from selective commits (which they provide a different interface for), what do you use the staging area for?
- ktt 10y agoNot the parent but I'm using it to stage sections of the file and then revert everything that is not staged. For example all logging statements. Or use staging as a mini commit. It's sometimes easier to look at the diff and stage what you consider to be working code without introducing commits. That of course could also be done with committing and then squashing but that's more work :)
- krupan 10y agoor committing and amending that commit, which is really no extra work
- indspenceable 10y agoA quick peruse doesn't show that there's a way to only commit certain parts of a file (like you can do in vanilla git via `git add --patch`)
- joshka 10y ago"There's also a p/partial flag that allows you to interactively select segments of files to commit." http://gitless.com/#gl-commit http://gitless.com/#gl-commit But looking at it, this seems like it would strongly couple the decision to include a part of a file with the commit process rather than something that I can be thinking about as I write the change. I think I'd likely find that irritating.
- sanderjd 10y agoThis is so tautological that it might sound sarcastic, but I frequently use it as a staging area before committing. Both for whole- and partial-file changes. This seems easier and more sensible than amending commits to me. When I use other version control systems that don't have this feature (which is maybe all of them?), I miss it.
- acemarke 10y agoThat's kinda the point, though. I don't want to run a single command to both define and complete the commit. I want to be able to do it in steps. Review my modified files, pick and choose what's staged, maybe make some more edits, stage those, double-check the staged diffs, verify the commit has what I want, and _then_ hit the button.
- krupan 10y agoYou make it sound like a commit is some final immutable set-in-stone thing and so you need staging area. Commits are only "set in stone" after you share (push) them with others.
- acemarke 10y agoYou're still missing my point. My preferred workflow is to iteratively put together the pieces I want, and only hit the "commit" button when I'm pretty sure I've got it crafted the way I want. Sure, I _can_ rebase, amend, and rewrite commits after creating them, assuming I haven't pushed them yet, but I'd much rather do it _before_ the commit is created. At first glance, this "gitless" tool doesn't seem to really support that workflow.
- derefr 10y agoWhy, though? What's the difference between a staging area that you convert into a commit, and an initially-empty commit that acts as a staging area, that you "commit" by just not modifying it any more, and instead creating a new empty commit (new staging area) to work in? They're bijective mappings of the same data, with the same actions triggered at the same points in a workflow. The only difference is what you label the actions. To go further: how do you feel if you think of all your un-pushed commits as simply "a chain of staging areas"? What if "committing" was something that happened at git-push time, and until then, you just created staging-area after staging-area and populated them with patch-chunks? Because this would also be a bijective mapping, involving the same actions in the same places.
- 10y ago
- FullyFunctional 10y agoWhy is that important given that you can do exactly the same with a commit in the local tree? I haven't read the paper, but the last paragraph in the article makes me a little sad. Then again, there were hardly any progress that wasn't met with significant resistance initially. (EDIT: typos)
- Mithaldu 10y agoIt comes down to levels of "written in stone"-ness, for lack of better words. There's a hierarchy of how much thought and effort change requires at various levels, starting at requiring no additional thought, to requiring considerable thought, and maybe even coordination with others: - changes on hdd - changes in staging area - changes in commit - changes in commit that came before a recent commit - changes in pushed commit I'm not entirely sure about the following, and i think it merits more thought, but here's my current state of mind about it: Technically you could do the same as the staging area by forcing the user to create a new, empty, but named commit when they decide they're done with the last one, and have all the current staging-affecting commands affect the last commit instead. However, for one, i think it may be easier to mess up and lose data unexpectedly when workign that way, and for the other, putting down a name for a commit when you're not even sure what it's gonna be may be an awkward way of working. Lastly, you'd also need to implement "empty" commits. I'm not sure how useful/easy that would be with git.
- icebraining 10y agoEmpty commits already are supported (see --allow-empty). And you can rename that commit at will using --amend, so the first name could simply be a placeholder - like "staging" :)
- dangom 10y agoIt's important to note that gitless aims to be a porcelain on top of git. That means git stash isn't going anywhere: both systems can operate together seamlessly on a same repository.
- krupan 10y agoI disagree. Forcing a weird pseudo commit, with its own unique set of commands for interacting with it, into the basic workflow is not the right approach. Without an index, beginners can just commit. As people get more adventurous, they can learn commands like commit --amend and rebase --interactive to build up and massage their commits.
- spinningarrow 10y agoSo what would be the workflow for committing (and perhaps pushing) partial changes in that case? Say you've made a lot of changes and they don't all belong together.
- gkya 10y agoIf I needed to do a partial commit I'd record the diff ("git diff > big.patch" or git stash), clean the repository, and build the patch to be committed manually picking from the recorded diff, test thoroughly and commit only when the patch is coherent (ie tests pass, compiles and runs). Then I'd just apply the rest of the patch to continue working. AFAIK the git model (git add [-p]) and history editing makes it very easy and probable to produce incoherent commits which when checked out does not compile, test all-OK or behave wrong. I use CVS for my personal stuff for various reasons but even if I used git I'd do it like this. P.S. if your granularity is in the level if files and not individual hunks of the overall patch then you can just "cvs/git commit files..." easily but still, it'll go in untested and you may have forgotten a change that was required in order to make the commited patch valid and coherent.
- rtb 10y agoI used to do that with SVN. What a pain in the ass. Git's version is miles better.
- bicolao 10y agoDo partial commits. Run a new interactive rebase session, set "edit" to all those commits so you can test out individual ones and fix up some more if needed. Basically the same outcome, but less manual diff editing.
- ngoldbaum 10y agoMercurial gets around this issue (without having a staging area) by providing an interface for interactively committing files or subsets of files via "hg commit --interactive"
- infogulch 10y agoI did not know that existed. Thank you for informing me.
- ngoldbaum 10y agoThere is also a very nice curses interface for interactive chunk selection. To turn it on set interface.chunkselector=curses under the ui section in your .hgrc.
- Mithaldu 10y agoGit has the same with `git add -p`, and if you're operating on a gui system, git-gui is excellent.
- lambda 10y agoThe staging area is a lot more useful than what you can do with an interactive commit, since it persists between operations. You can use it to accumulate changes that are "done" while you continue to experiment with some other changes on top, even if you're planning on committing the whole thing at once, and if you wind up not liking your new changes, revert to what you had in the staging area; or you can realize what you're working on will be easier to finish as two commits, stage part of it, stash the other part, finish the part that was staged and commit it, then apply the stashed part and finish that too. This is a lot more than you get with just a single interactive commit operation. You could use a commit for this purpose, and continually amend or revert this commit, but in terms of UI, it's helpful to have a set of operations specifically for moving things in and out of the staging area that's different than what you do for manipulating commits on general.
- Too 10y agoThe whole problem with the staging area in git is that it persists between operations. Why would you want to add things piece by piece and not commit them? If they are done enough to be added they are done enough to be committed and if they are not you keep working on them together with all other unfinished files. Once you actually are ready to commit you can choose which files that are in fact ready.
- toomim 10y agoDid you read the gitless instructions? [1] You get the same functionality as a staging area by keeping a list of all the files you want to commit, and then run once: gl commit -o file1 file2 file3 file4 [1] http://gitless.com http://gitless.com
- dajohnson89 10y agoand if my change affects two hundred files, across dozens of directories?
- toomim 10y agoYou find it hard to create a list? Here's an example of making a staging file: echo file1 > staging # e.g. git add file1 echo dir2/file2 >> staging # e.g. git add dir2/file2 echo dir3/file1 >> staging echo dir3/file5 >> staging echo dir4/dir9/dir394/file384 >> staging And committing the file: eval "$(echo gl commit -o `cat staging`)" # e.g. git commit
- to3m 10y agoDude.
- jdmichal 10y agoCongrats. You just recreated a bad implementation of the staging area in a text file.
- toomim 10y agoCongrats, you got the joke! ;) A staging area is just a list of things to commit. There are many ways to make lists. I personally use emacs because direct manipulation rocks. Complaining about a change in one way to make lists is silly—gitless introduces much more powerful basic mechanisms like uncommitted branching, and lists belong on top of these more powerful basic features; not underneath like in the traditional porcelain.
- gkya 10y agoHow do you test what is in the staging area as a subset of all the changes fir consistency (i.e. can you be sure when committed and later checked out it will be a coherent stage of the project history that will test compile and run okay)?
- deleted 10y ago[deleted]
- morsch 10y agoCommit (don't push), stash remaining changed files, compile and run your tests. If anything goes wrong, either fix it and commit --amend, or reset --soft HEAD~ to return the commit to the staging area and fix from there. Unstash as required.
- slavik81 10y agoPerhaps the worst piece of UX in all of git is the naming of the staging area. The docs and arguments use 'index', 'cache' and 'staging' all to refer to the same thing. The names 'index' and 'cache' are awful, but the inconsistency is unforgivable.
- nerdponx 10y agoI still have to check myself when I see references to the "work tree"
- Mithaldu 10y agoWhile the staging area could use some UX improvements, it is the most important part of git and proper usage of it fosters good history clarity and code quality For that reason i agree strongly. Any attempt to improve git that does not move the staging area more to being the default way of operating is misguided at the code.
- deleted 10y ago[deleted]
- Pharylon 10y agoThe original paper is here: http://people.csail.mit.edu/sperezde/pre-print-oopsla16.pdf http://people.csail.mit.edu/sperezde/pre-print-oopsla16.pdf Their "veneer" of git is here: http://gitless.com/ http://gitless.com/
- randomsofr 10y ago> Many people complain that Git is hard to use. Really? Do people think that?
- wbkang 10y agoYes and the paper in the article tries to explain conceptually why it can be hard to understand.
- no_protocol 10y agoCan anyone share other git porcelain projects? I'm especially interested in any that are not necessarily intended for use with code. Think more along the lines of writing or something, maybe. Any kind of refs juggling that isn't just standard git.
- rurban 10y agomagit being the most prominent and most widely used. Within the emacs GUI. Makes most of those tasks much easier. Hub is a prominent GitHub remote porcelain tool. I also want to point out shell prompt tools to display the current git status, which would have helped in many of those misfits.
- isxek 10y agomagit being the most prominent and most widely used. Within the emacs GUI. Since magit was mentioned, I'll add 'fugitive', the Git wrapper for Vim described to be 'so awesome, it should be illegal.'
- brensmith 10y agoI'm a big fan of GitUp. http://gitup.co/ http://gitup.co/
- PrimeDirective 10y agoThere's not a goddamn thing that's fundamentally wrong with git. My worthless 2c.
- forrestthewoods 10y agoSure there is. It's inscrutable and utterly non-discoverable. Even programmers need a dedicated Git expert on staff to help escape bad states. Non programmers are utterly helpless. Also it fundamentally can't handle binary files well. This causes great pain.
- david-given 10y agoIt's from 2012, and some (but not all) of the things that are complained about here have been fixed, but Steve Benett's classic blog post verbalises all the problems I have with the git UI way better than I can, and is still quite valid: https://stevebennett.me/2012/02/24/10-things-i-hate-about-git/ https://stevebennett.me/2012/02/24/10-things-i-hate-about-gi...
- PrimeDirective 10y agoI guess lots of things have barriers and might not be for everyone. Don't mean they're flawed. Also, git can't handle my laundry. That causes great pain.
- forrestthewoods 10y agoThat's fair. But tools used by everyone on a team should probably be, at least, for those captive users.
- crimsonalucard 10y agoRight, but barriers that a high percentage of users experience means it's a flaw. This factor cannot be ignored. Taken to the extreme your statement is essentially: "Git works for me and me only therefore it is flawless."
- robot 10y agoPeople take version control for granted (thanks to git) and then claim it has " design flaws and misfits". It can be tailored to be more user friendly sure. But the original philosophy of git was to build distributed version control system that is efficient, straightforward, and dependable. All of those goals are achieved with its design and improving on this foundation is certainly possible. These were all hard problems to solve at the time, given the state of the art was CVS, subversion and perforce.
- aab0 10y ago> All of those goals are achieved with its design and improving on this foundation is certainly possible. These were all hard problems to solve at the time, given the state of the art was CVS, subversion and perforce. The state of the art was not CVS, Subversion, and Perforce when git had its first release in 2005. The state of the art was BitKeeper (which you might remember had a certain connection to Linus and git), Arch, Monotone, and Darcs, and Mercurial itself was first released almost simultaneously with git. And one can debate the extent to which git was an improvement on any of those on key features like cryptographic signing or UI/UX.
- NumberSix 10y ago"People take version control for granted (thanks to git)..." Nonsense. Version control software has existed and been in widespread use since at least the 1980's. https://en.wikipedia.org/wiki/Revision_Control_System https://en.wikipedia.org/wiki/Revision_Control_System Walter Tichy released RCS in 1982. CVS is derived from RCS, Subversion from CVS.
- kazinator 10y agoCVS was released to Usenet as shell script sources only in 1986; not that far after RCS. Subversion is not derived from CVS; it was a project inspired by problems in CVS, to replace it.
- NumberSix 10y agoFrom http://svnbook.red-bean.com/en/1.7/svn.intro.whatis.html#svn.intro.history http://svnbook.red-bean.com/en/1.7/svn.intro.whatis.html#svn... Subversion's History In early 2000, CollabNet, Inc. (http://www.collab.net http://www.collab.net) began seeking developers to write a replacement for CVS. CollabNet offered[3] a collaboration software suite called CollabNet Enterprise Edition (CEE), of which one component was version control. Although CEE used CVS as its initial version control system, CVS's limitations were obvious from the beginning, and CollabNet knew it would eventually have to find something better. Unfortunately, CVS had become the de facto standard in the open source world largely because there wasn't anything better, at least not under a free license. So CollabNet determined to write a new version control system from scratch, retaining the basic ideas of CVS, but without the bugs and misfeatures. Note "retaining the basic ideas of CVS, but without the bugs and misfeatures." derive base a concept on a logical extension or modification of (another concept).
- c3RlcGhlbnI_ 10y agoThe paper doesn't discuss much how their implementation does better on their listed issues. One particularly interesting issue git has is referred to at one point as "Incoherent Commit": "The problem with commit is that it constitutes a violation of the coherence criterion: the same concept (commit) has more than one, unrelated, purpose: make a set of changes persistent (P1) and group logically related changes (P2). "These two purposes are not only unrelated, but in tension with each other. On the one hand, you would like to save your changes as often as possible, so that if something bad happens you lose as little data as possible (thus encouraging early committing). On the other hand, a logically related group of changes usually involves multiple individual changes, which means that you might be working for quite some time before you have enough changes to group (thus encouraging late committing). Now a fix for that would be useful. Git only provides you with the ability to create a graph, and you get to choose what you use it for. You have to choose though because there is only one graph. Gitless doesn't seem to fix this problem, you still have to choose what goes into your final commits. Though I don't know what you could do about it without changing git to support something like grouping commits into blocks that are modified as a unit.
- tbrownaw 10y agoGit allows you to do violence to history: it's very much possible to commit regularly as you work, and then rearrange those commits later to be more logical. I have no idea how easy this is, but I've seen plenty about how horribly impolite it is when you rearrange any history that other people have seen.
- tylorr 10y agoIt helps if you keep unrelated code in separate commits. That way all you have to do is rearrange and merge commits. It gets more complicated if you have to split commits. I've been wanting to make a GUI for this purpose that allows you to drag and drop hunks/commits. Essentially a GUI for interactive rebase. And yes, don't change history others have seen, but do it as much as you need locally. EDIT: typo/clarity
- 10y ago
- toomim 10y agoWow, I'm trying this out on my git repositories and it's great! Look how simple it is to "install": tar xzvf gl-v0.8.3-darwin-x86_64.tar.gz sudo cp gl-v0.8.3-darwin-x86_64/gl /usr/local/bin/ Now you can play with the commands on any git repository: $ cd ~/projects/farmhouse $ gl diff # Woah cool! It uses whitespace to separate blocks! $ gl branch # Wow, this not only shows you the branches, but explains # all the other branching commands, like how to switch # branches! Now I know that I can just: $ gl switch master # done! And because it's just an alternative wrapper for git, you can switch back and forth, at any time, on any repo.
- js8 10y agoI fail to see how Git has a bad UX.. the way it took over other CVSs by storm suggest that those systems had UX that was significantly worse. In fact, I think you would be hard-pressed to find a recent piece of software which was a bigger success, UX-wise. Or why is Git popular, then? Could Github be built on, say, SVN? Many times in IT, popularity is also driven by support of a large corporation, but it was non-existent in this case.
- sofal 10y agoI think Git's success over solutions like CVS or SVN is the superiority of the underlying data model in its ability to take into account the complexity inherent in software being developed by multiple people at once, while at the same time allowing for individual developers to effortlessly fork their own various tasks.
- gkya 10y agoI guess git's success owes most to the Torvalds as mercurial was started contemporaneously and quite similar in being a DVCS.
- ern 10y agogit is popular because git is popular (and also because of the DVCS model). I'm pretty sure that it didn't win because of UX but because of network effects (https://en.m.wikipedia.org/wiki/Network_effect https://en.m.wikipedia.org/wiki/Network_effect). There are plenty of irrational decisions made by developers based on "geek cred" and status signaling. Regardless of the reason for its success, git has a huge installed base and plenty of online help to find one's way out of a corner. Having git skills is also a big plus for employability. I have migrated teams onto git rather than Mercurial solely for these reasons. UX was a secondary consideration.
- js8 10y agoSo do you think Linus made a mistake writing Git and should have gone with Mercurial instead? I mean, the argument by popularity can apply to CVS and SVN too, which were at times more popular than Git.. I don't find it a very convincing explanation. Popularity could have been the reason why people chose Git over Mercurial specifically (if you're talking about DVCSs), but this kinda makes what Linus did a bad choice. What I am saying is if people chose inferior product (with worse UX) due to popularity or network effects, then this was a mistake, and you should be able to point out what exactly the mistake is.
- deleted 10y ago[deleted]
- throw2016 10y agoI am sure like all things Git can be improved and I think the idea that users are not open to improvement is more often than not a defensive response from those whose idea of 'improvements' do not resonate. It's always dubious for those with new offerings to dismiss criticism as 'resistance' and 'defensiveness'. This is extremely disingenious and intentionally takes things from the technical to the political. They have taken up a marginal use case which matters to them which is fair but then try to dress it up as a git weakness with an elaborate paper which plays up their use case and scatters around strawmen like 'Git is difficult to use' unquestioned. Isn't it possible that the 'shortcomings' are not an issue to other users who may not identify with the use case highlighted and may not perceive it as an 'improvement'. I think git stands alone in stark defiance to a growing culture of complexity. Given the scope Git could have been an extremely complex and bulky piece of software. Its a testament to the experience of the authors that it is accesible to most and used by millions. I have no doubt in lesser hands Git would be hugely more intricate and a complete pain to use.
- Meic 10y agoThose who do not remember cogito and easygit are doomed to reimplement them.
- gwenzek 10y agoI had to teach git to 10 non-developer (for small configuration code, and configuration files) used to SVN. The stagging area wasn't really a problem to learn. Most of the problem they had came from stashing: "I want to pull but git doesn't want to !" Or changes following you when switching branches: "I worked in developed, now I'm back to master and I have all this files modified!" Which could lead to a "reset --hard" for getting rid of those changes, which was generally regretted after that! Also I had a few detached head states due to simple double-click on a commit name in the UI that resulted in a checkout, when they just wanted to see the commit log. Finally a lot of confusion arised from using SourceTree that shows you a window with ten options every time you try to pull. (SourceTree wasn't my choice) So I think gitless does provide an improvement by getting rid of the stash, but I don't really see the point of removing the staging area.