Most active commenters
  • wruza(6)
  • ajross(4)

←back to thread

1062 points mixto | 38 comments | | HN request time: 1.273s | source | bottom
Show context
scrapcode ◴[] No.42942555[source]
I can't help but feel that Git has completely missed the forest through the trees that you can make a 30+ part guide explaining how to use it.
replies(6): >>42942641 #>>42942672 #>>42942768 #>>42943372 #>>42950299 #>>42954886 #
1. ajross ◴[] No.42942768[source]
My sense, bluntly, is that if people spent half the effort learning git that they do whining about it, no one would bother making a 30+ part guide just explaining stuff you could find in a man page.

Commits are snapshots of a tree. They have a list of ancestors (usually, but not always, just one). Tags are named pointers to a commit that don't change. Branches are named pointers to a commit that do change. The index is a tiny proto-commit still in progress that you "add" to before committing.

There. That's git. Want to know more? Don't read the guide, just google "how to I switch to a specific git commit without affecting my tree?", or "how do I commit only some of my changed files?", or "how to I copy this commit from another place into my current tree?".

The base abstractions are minimalist and easy. The things you want to do with them are elaborate and complicated. Learn the former, google the latter. Don't read guides.

replies(7): >>42942804 #>>42942870 #>>42943548 #>>42944155 #>>42944541 #>>42946116 #>>42946888 #
2. skydhash ◴[] No.42942804[source]
Or do read books and guides. But in an exploratory manner. So when you do have a need for a specific operation (which happens rarely) you have a mental map that can give you directions.
3. chasil ◴[] No.42942870[source]
The deal killer for me, the inescapable aspect of my users, is that they insist upon checking passwords into revision control.

Because the C and PL/SQL people are on CVS, I can fix this with vi on the ,v archive.

First on TFS repositories, and now with git grep I can easily find exposed passwords for many things. But it's just SQL Server!

We will never be able to use git responsibly, so I will peruse this guide with academic interest.

Don't even get me started on secrecy management.

I am looking forward to retirement!

replies(2): >>42943235 #>>42944662 #
4. rblatz ◴[] No.42943235[source]
The devs shouldn’t have access to prod credentials in the first place. That’s the real issue.
replies(3): >>42943631 #>>42944141 #>>42947717 #
5. billdueber ◴[] No.42943548[source]
Sigh. Another git thread, another pile of posts telling me that if I would _just do the work_ to understand the underlying data structure I could finally allow myself to be swept up in the _overwhelming beauty_ of the something something something.

The evidence that the git UI is awful is _overwhelming_. Yes, yes, I’m sure the people that defend it are very very very very smart, and don’t own a TV, and only listen to albums of Halloween sounds from the 1950s and are happy to type the word “shrug“ and go on to tell us how they’ve always found git transparent and easy. The fact is that brilliant people struggle with git every single day, and would almost certainly be better served by something that makes more sense.

replies(6): >>42943697 #>>42943915 #>>42944056 #>>42946890 #>>42947781 #>>42975675 #
6. chasil ◴[] No.42943631{3}[source]
Internal audit said the same thing.

Quelle surprise!

7. Izkata ◴[] No.42943697[source]
GP isn't describing the underlying data structures, they're describing the basic interface of commits, branches, and tags. The 101 stuff you have to learn regardless, for any version control, not just git. Dismissing it like this just sounds like someone who refuses to hold scissors by the handles.
replies(1): >>42943842 #
8. billdueber ◴[] No.42943842{3}[source]
You’re right, of course, and I apologize to GP for conflating what they were saying with what I, to be fair, do often see in these threads.

Like others in these comments, I can use it just fine right up until I can’t. Then it’s back to the mini, many, many posts and questions and tutorials, sprawled across the Internet to try and solve whatever the issue is. JJ has shown that a better chrome can be put over the underlying model, And it’s frustrating to me that we are all collectively, apparently, expected to put up with a tool that generates so much confusion seemingly regardless of brilliance or expertise

9. ajross ◴[] No.42943915[source]
Pretty much, yeah. Just do the work. It's not nearly as hard as whatever it is you're committing into it, I promise. Continuing to mock it via florid metaphor doesn't help anyone at this point.
replies(1): >>42944032 #
10. gitgood ◴[] No.42944032{3}[source]
I'm always kind of aghast at the number of people who not only don't know git, but who cannot or will not learn it over years, or even decades.

Listen, I'm not that smart, and I managed to figure out how to solve even gnarly git issues one summer during an internship... 11 years ago? Ish? Now, I know git well, and not just "the three commands". I would be, honestly, so ashamed if it were a decade on and I still hadn't committed to learning this fundamental tool.

Version control is a hard problem, fundamentally, and a tool for experts will always take more effort to understand. I mean, aren't we supposed to be the software experts? If people can't learn git, I wouldn't trust them with the even harder parts of software development.

But this is a common attitude in industry now, unfortunately: a petulant demand for things to be easier, and for someone else to do the learning. Is it any wonder software today is so bad?

replies(1): >>42944681 #
11. gitgood ◴[] No.42944056[source]
I don't struggle with git, and I can assure you, I am not brilliant. I do, however, refuse to give up when something seems hard, and I refuse to ask the computer to be easier for me. (Understandably, I started programming computers to make them do what I wanted them to do, not to sit and whine when they didn't.)
12. sampullman ◴[] No.42944141{3}[source]
Commiting credentials is also a real issue, best to avoid doing both.
13. rtpg ◴[] No.42944155[source]
I think the trickiness with the simple abstraction is that you end up looking at a commit graph and thinking "I would like to make a couple new nodes in this in a very specific shape, but one that many people have likely done in the past. Is there a trick?"

Like so much of the porcelain is those kinds of tricks, and make otherwise tedious work much simpler.

Imagine if you didn't have interactive rebases! You could trudge through the work that is done in interactive rebases by hand, but there's stuff to help you with that specific workflow, because it is both complicated yet common.

I think jujutsu is a great layer over git precisely because you end up with much simpler answers to "how do I change up the commit graph", though.... the extra complication of splitting up changes from commits ends up making other stuff simpler IMO. But I still really appreciate git.

14. wruza ◴[] No.42944541[source]
This doesn’t work. Look:

Commits are sets of files. They form a tree. A branch is a named location in this tree. The index aka staging area is a pre-commit that has no message. Workdir is just workdir, it doesn’t go in the repo unless you stage it. HEAD is whereafter commit will put new changes.

Do I understand git? Seems like yes. Let’s run a quiz then! Q? A.

How to make a branch? Git branch -a? Git checkout -b --new? Idk.

How to switch to a branch? Git switch <name>, but not sure what happens to a non-clean workdir. Better make a copy, probably. Also make sure the branch was fetched, or you may create a local branch with the same name.

How to revert a file in a workdir to HEAD? Oh, I know that, git restore <path>! Earlier it was something git reset -hard, but dangerous wrt workdir if you miss a filename, so you just download it from git{hub,lab} and replace it in a workdir.

How to revert a file to what was staged? No idea.

How to return to a few commits back? Hmmm… git checkout <hash>, but then HEAD gets detached, I guess. So you can’t just commit further, you have to… idfk, honestly. Probably move main branch “pointer” to there, no idea how.

If you have b:main with some file and b:br1 with it, and b:br2 with it, and git doesn’t store patches, only files, then when you change b:main/file, then change and merge+resolve b:br1/file, then merge that into b:br2 to make it up-to-date, will these changes, when merged back to already changed b:main become conflicted? Iow, where does git keep track of 3-way diff base for back-and-forth reactualization merges? How does rebase know that? Does it? I have no idea. Better make a copy and /usr/bin/diff [—ignore-pattern] the trees afterwards to make sure the changes were correct.

As demonstrated, knowing the base abstractions doesn’t make you know how to do things in git.

I don’t even disagree, just wanted to say fuck git, I guess. Read guides or not, google or reason, you’re screwed either way.

replies(3): >>42946246 #>>42947164 #>>42948715 #
15. rswail ◴[] No.42944662[source]
Sounds like you need a pre-commit hook to check.
replies(1): >>42945750 #
16. wruza ◴[] No.42944681{4}[source]
If people can't learn git, I wouldn't trust them with the even harder parts of software development.

This idea breaks under pressure. People have limited concentration and the more you demand for daily routine, the less there’s left for the actual job. This argument only makes sense in a relaxed setting with lots of time and coffee breaks. But all these problems tend to happen at friday evening when you’re expected to get your kids in an hour or something and this damn repo got broken again.

Yes, things should be easier. Cause you get what you get. If you want people who have no issues with git, feel free to enjoy the greatly reduced hiring pool and stop whining about someone not being able to juggle fifty things at once in their mind - focus on your hiring process and where to get the budget for inflated compensation instead.

Is it any wonder software today is so bad?

I remember delphi and vb time, when people - who were unable to understand or use CVS and SVN - made full-blown apps for real sectors, and it worked. Because it was easy. Nowadays all we have is important dudes with pseudo-deep knowledge of git, css, framework-of-the-month and a collection of playbooks, who cannot make a db-enabled hello username message box in less than a day. I don’t think you’re moving in the right direction at all with this. This paradigm is going further and further from good software, actually.

replies(1): >>42948365 #
17. maccard ◴[] No.42945750{3}[source]
Pre commit hooks aren’t enforcable. People need to opt in to them, and the people who opt in to them are the people who will check for passwords before they commit.
replies(1): >>42946680 #
18. ssivark ◴[] No.42946116[source]
> Commits are snapshots of a tree. They have a list of ancestors (usually, but not always, just one). Tags are named pointers to a commit that don't change. Branches are named pointers to a commit that do change. The index is a tiny proto-commit still in progress that you "add" to before committing.

This is about as useful as "A monad is just a monoid in the category of endofunctors."

It's basically a lot of words which make zero sense for a user starting to use git -- even if it happens to be the most succinct explanation once they've understood git.

> The base abstractions are minimalist and easy. The things you want to do with them are elaborate and complicated. Learn the former, google the latter.

You can't really learn the former -- you can't even see it till you've experienced it for a while. The typical user groks what it means after that experience. Correction, actually: the typical user simply gives up in abject frustration. The user who survived many months of using a tool they don't understand might finally be enlightened about the elegant conceptual model of git.

19. abenga ◴[] No.42946246[source]
Skill issue, it seems.

Facetiousness aside, the things you do often, you learn once and you don't really have to remember/think when doing them. Most of the esoteric operations are mostly unnecessary to burden yourself with until you actually have to do them, when you just read the documentation.

20. n_plus_1_acc ◴[] No.42946680{4}[source]
Server-side pre-recieve hooks are better
21. globular-toast ◴[] No.42946888[source]
There is one fundamental piece missing in your description of git that I think is the main reason people don't understand it. You have described a single DAG, but in git there are multiple DAGs. This is what it means to be a distributed version control system.

In my experience people come to git and start using it with the centralised paradigm in their heads: that there is one repo and one DAG etc. They think that their master branch is the same as "the" master branch. You just can't get good at git with this wrong understanding.

replies(1): >>42955057 #
22. jeroenhd ◴[] No.42946890[source]
There are tools for the UI part. Most people I know only use command line git for doing stuff where GUIs give up (i.e. fixing repos in weird states). Usually, checking out a clean clone and switching to that will do the same without the GUI, just takes a bit longer if you know the command line fixes.

The issues most people seem to have with git are common version control issues. Version control is actually hard, even if it's just "what has changed", once you start going beyond two users editing a file at once. When three people edit a file at the same time, there's going to be complexity when those changes need to be applied back, and that's where you start getting into branching/merging/rebasing.

Just like some people simply cannot get functional programming/object oriented programming/imperative programming to click in their head, others will never truly grasp version control. It's a paradigm of its own. People who know lots of data structures like to trivialise version control into data structures ("it's just a list of ...") but the data structures are the chosen solution, not the problem.

Another complexity issue is that git is actually pretty smart, and will fix most problems automatically in the background. Often, when you need to manually operate on a git repo, you're in a situation where git doesn't know what to do either, and leaves it up to you as the expert to fix whatever is going on. And frankly, most people who use git are nowhere close to experts. The better Git tooling gets at fixing these situations for you, the worse your situation will be once you need to manually correct anything, and the worse your perception might get.

I have no good advice for you on how to work Git better. All I can say is that I'm very productive with Jetbrains' IDE integration, others seem to prefer Visual Studio Code's git integration, and then there's the Tortoise people. Find whatever tool works best for you and hope you'll have a random epiphany one day.

23. ajross ◴[] No.42947164[source]
Literally every one of those questions can be trivially googled. (In previous generations and fora, this is where you'd be mocked with LMGTFY links). You just, to continue to embrace the frame, don't want to do the work.

If you insist on memorizing commands for all these tasks (of which there are many), indeed, you're going to struggle and decide you need a 30 section guide. But you don't, and want to whine about it.

> I don’t even disagree, just wanted to say fuck git, I guess.

Pretty much.

replies(3): >>42947650 #>>42947810 #>>42948729 #
24. delta_p_delta_x ◴[] No.42947650{3}[source]
Not the parent commenter. Git the version control system is superb, fast, robust, well-thought out. Git the CLI tool is by far one of the worst CLIs I have ever had the misfortune of using. I think the one-dimensional, string-y command-line massively complicates mental and reasoning models for a tool with a fundamental data structure—a tree—that is multi-dimensional.

A powerful Git GUI makes even moderately-complicated actions like cherry-picking, interactive rebasing, and even ref-logging absolutely trivial. In fact it was precisely said GUI tool that allowed me to develop an intuition for how Git worked internally; the CLI does no such thing.

25. zelphirkalt ◴[] No.42947717{3}[source]
Then you need to hire someone else to manage the deployment of services though.
26. zelphirkalt ◴[] No.42947781[source]
Which brilliant people, who have put in an appropriate amount of time into learning any (D)VCS, are struggling with having a day to day working knowledge/familiarity with git? Can you point to some? Brilliant people is of course a definition question. But one of the defining qualities I would ascribe to a brilliant person, is the ability to quickly grasp concepts and ideas and reason about them. That seems to me to be the core quality one needs to use git, since it requires one to have a mental model, whether actually correct (which I think few people have) or just close enough to be useful.
27. MrJohz ◴[] No.42947810{3}[source]
> Literally every one of those questions can be trivially googled. (In previous generations and fora, this is where you'd be mocked with LMGTFY links). You just, to continue to embrace the frame, don't want to do the work.

I find this an odd statement. I mean, no, I don't want to do the work! Not if it isn't necessary in the first place.

Take staging (or the index, because another of Git's foibles is poor naming conventions that stick around and confuse newcomers). It's kind of a commit, right? In the sense that it's a snapshot of work that represents a change to the code. Except we can't really make it behave like a commit, we have to interact with it using special commands until we turn it into a commit. Are these special commands really doing much differently than we might do with another commit? Not really.

Or take stashes. Stashes are more like commits — they even appear in the reflog! But they also aren't real commits either, in the sense that you can't check them out, or rebase them, or manipulate them directly. Again, you need a bunch of extra commands for working with the stash, when really they're just free-standing anonymous commits.

Or take branches. Branches are, as everyone knows, pointers to commits. So why is it important whether I'm checking out a branch or a commit? Why is one of these normal, but the other produces hideous warnings and looks like it loses me data if I haven't learned what a reflog is yet? And if a branch is just a pointer, why can't I move it around freely? I can push it forwards, but I can't move it to another arbitrary commit without fiddling around a lot. Why?

Or take tags, which are like branches, but they don't move. Is "moves" and "doesn't move" such a deeply important distinction that Git needs branches and two different kinds of tag?

---

To be clear, I think Git is a good tool, and I agree that once you've started to familiarise yourself with it, it's not so complicated in day-to-day usage. Yes, you'll probably need to Google a few specific commands every so often, but the general UX of the tool has significantly improved since the early days, and it is getting better.

That said, I also don't like the idea of settling with Git just because it's good. If there are alternatives out there that can do everything that Git can do, but with a simpler conceptual model, then I want to try them! (And, spoiler alert, I think there are better alternatives out there — in particular, I think Jujutsu is just as powerful as Git, if not more so, while simplifying and removing unnecessarily duplicated concepts.)

replies(2): >>42948918 #>>42953987 #
28. ajross ◴[] No.42948365{5}[source]
> Nowadays all we have is important dudes with pseudo-deep knowledge of git, css, framework-of-the-month and a collection of playbooks, who cannot make a db-enabled hello username message box in less than a day.

Interestingly that is exactly the opposite of my experience. Git is a practical tool with practical appeal to people who want to do practical things. Egghead gedankentheorists hate it, as evidenced by this very subthread.

In point of fact I find the ability to accomplish workaday tasks with git to be a far better predictor of someone's success as a developer than stuff like being able to recite Rust minutiae. People who like git are people who like getting stuff done.

replies(1): >>42949459 #
29. nextlevelwizard ◴[] No.42948715[source]
Knowing how to make a branch is very basics of using git. If you don’t know how to do it (git checkout -b, btw) you are just outing yourself as someone who doesn’t use git or your just push to master i.e. you are only working on solo projects.

You can switch branch also with ‘git checkout’ and you just ‘git stash’ your changes.

‘git reset’ is fine to reset files, but again if you just want to ”clean” repo you can stash.

You can reset staged files again with ‘git reset’

Mo idea why you would want to checkout a random commit and the start committing from that, but you can also just ‘git reset --hard HEAD~x’ where ‘x’ is number of commits you want to go back. Hard is optional, but I assume that is what you want based on your comment.

Depends on the change. If you change different lines there will be no conflicts.

This is all basic stuff you should know if you are developing code with other people

replies(1): >>42950322 #
30. wruza ◴[] No.42948729{3}[source]
First I didn’t understand git, now I don’t want to do the work. Then I do the work but it doesn’t work. Feel free to LMGTFY me on the last question. Do you know the answer? Is there an answer? Can you do the work?

What a stupid series of sentences this is for a piece of software we have to use daily. Even talking about it feels cringe.

31. wruza ◴[] No.42948918{4}[source]
Jujutsu

Whew, just from the intro this feels like a breath of fresh air. Probably gonna migrate to it right after finishing the tutorial. Thanks for mentioning!

https://github.com/jj-vcs/jj

32. wruza ◴[] No.42949459{6}[source]
People, whom I knew since these times and who really like getting stuff done and have done it much, all facepalmed when seen things like git, webdev, etc. Getting stuff done is not performing hundreds of technical operations and thinking “good, I’m so skilled”. It’s actually getting it done. I can almost guarantee that it’s a guy with far better predictor skills who will deliver mvp a month later than everyone else. Been through this countless times.
33. wruza ◴[] No.42950322{3}[source]
Threaded merges are easy to screw up, that's why git invented that "rebase" crutch, both be-cause and the-cause it doesn't know which changes are in revision, only the file contents. Not sure how one can look at it and not see (or meet) the problem. "If you change different lines there will be no conflicts." Oh really, I guess I have had no have issues with merging in long branches then, good to know it was fine. You can merge back and forth and it just works. No one itt has merge anxiety, you just do it and it's all fine, and if there are conflicts, it's only for the same lines. Would be laughable if a thing like git had a huge engineering gap here, good thing it doesn't. /s

You can reset staged files again with ‘git reset’

To "revert a file to what was staged" you have to "git checkout" again, it seems, not "reset".

This is all basic stuff you should know if you are developing code with other people

Yeah. It seems that it is basic, until you try using it for something that is not quick one-shot patching of "append-only" code.

34. MatthiasPortzel ◴[] No.42953987{4}[source]
> Stashes are more like commits — they even appear in the reflog! But they also aren't real commits either, in the sense that you can't check them out, or rebase them, or manipulate them directly.

They are real commits, you can check them out (it detaches your HEAD, the syntax to reference them is `stash{N}`). Although I think this furthers, rather than undermining, your point that there are an unnecessary number of other commands to work with the stash.

I think this is a failure of the git CLI as much as the internal data-structures. I think the idea of a commit tree is very good and a lot of people recognize that. The commands that git exposes to work with that tree can sometimes be miserable.

replies(1): >>42954870 #
35. MrJohz ◴[] No.42954870{5}[source]
I did not know you could check them out! But yeah, that really emphasises what I'm saying: there are too many things that are mostly commits but handled in a different way.

And I completely agree that this is about the CLI more than the internal data structures. I pointed at Jujutsu earlier, and that uses Git as the underlying data store (at least in its default configuration). It's an effective strategy in large part because Git-as-a-data-structure works really well already, and the distributed aspect means you can interop very effectively with existing tools like Github just by speaking the right protocol.

But while it keeps much of the same data structures, Jujutsu exposes a very different interface to those data structures, and one that I think is significantly simpler in large part because there aren't so many special cases (such as commits vs staging vs stashes vs ...). You end up with a smaller set of commands, but those commands are more consistent and can be applied in more cases. And you still have staging and stashes, it's just that you can build those yourself more naturally out of the tools that Jujutsu gives you.

36. HdS84 ◴[] No.42955057[source]
My problem is that I always use git as a central server. Except that one time when our internal git was down and we used it peer to peer for a day. Honestly, using USB sticks for that would also have been okay.
replies(1): >>42962353 #
37. globular-toast ◴[] No.42962353{3}[source]
> Honestly, using USB sticks for that would also have been okay.

Right! People often forget git was designed specifically for Linux kernel development which is done by a loosely-knit global base of developers. There are much simpler solutions if you can actually live with exchanging USB sticks.

One nice thing is only needing to know one tool for both open source and centralised development, though. It can seem a little odd if you don't do any open source at all, though.

38. _proofs ◴[] No.42975675[source]
perhaps it is time to take some personal accountability instead of lamenting the complexity in order to avoid the (overwhelming) challenge and learning.

yes, to understand an application, you must also understand the underlying data structures, architectures, models, use cases -- i am not sure what there's to roll eyes at. but there's no requirement that says that understanding has to be deep in order to work on it, or use it.

i think if you treat it like cleaning a large room, by picking out one corner at time and focusing on cleaning that before moving on, you'll find that the room is cleaned in no time, and git isn't anywhere nearly as complicated as it may feel.

there is absolutely no reason to digest a guide this dense for use-cases in every day production settings, bc those usages only make up about 10% of what this guide covers.

yes, learning things can be overwhelming, challenging, full of darkness and terrors, but that's what learning is, until you've learned.

but here is the catch imo: once you've learned, you don't stop learning and the challenges don't go away. you just become better at navigating the darkness, bc you get better at learning and managing feelings of overwhelm and confusion which are by products of complexity -- real or perceived or both.

jump in. it ain't that scary, even if it feels scary. i promise. i've been there, and you can overcome it.