Most active commenters
  • sampullman(4)

←back to thread

1062 points mixto | 16 comments | | HN request time: 0.215s | 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. verandaguy ◴[] No.42942672[source]
Eh, yes and no.

Git porcelain stuff's plenty good for probably 95% of users. `rebase -i` comes with a guide on which commands do what, and you could write a couple of paragraphs about how to format `git log`'s output with your own preferences and tradeoffs -- and porcelain usually includes stuff as eclectic as `git gc`, `git fsck`, and `git rev-parse` by most accounts.

Git plumbing's definitely a bit more obscure, and does a bunch of stuff on its own that you can't always easily do with porcelain commands because they're optimized for the common use cases.

TL;DR: while Git's big (huge even), a lot of what it provides is way off the beaten path for most devs.

replies(2): >>42942997 #>>42946334 #
2. ujkiolp ◴[] No.42942997[source]
not my experience - almost always some edge case leads me to a git rabbit hole

tldr: even if you never plan to use anything advanced, you’ll end up in some weird situation where you need to do something even if you’re in the “95% of the users”

no shade, yes ofc you “could this, could that” to make things work and we have been stuck with this for so long that an alternative doesn’t even seem plausible

replies(1): >>42944088 #
3. sampullman ◴[] No.42944088[source]
I can't remember the last time I ended up in a weird situation, I stick to basic options with init,clone,fetch,checkout,branch,commit,rebase,remote,log,stash,cherry-pick,blame,config.

It did take maybe a year or so to develop the mental model of the how commands map to the underlying structure of commits, and another few years to avoid footguns (like always "push --force-with-lease").

So I think it is probably too complicated and would be happy to switch to a better alternative if one comes up, but what seems really implausible to me is going back to the bad old days of SVN.

replies(2): >>42944184 #>>42944903 #
4. ujkiolp ◴[] No.42944184{3}[source]
>It did take maybe a year or so

we have normalized this for git - a tool to store versions of text. That’s the problem

replies(2): >>42944793 #>>42945144 #
5. sampullman ◴[] No.42944793{4}[source]
A folder with a list of files is a tool to store versions of text. Git is somewhat more useful.
6. crabbone ◴[] No.42944903{3}[source]
You are using Git in a non-automated way, basically, as a substitute for rsync (you never edit history, you only append to it, you don't deal with a possibility of multiple remotes, you don't deal with modular projects and you don't automate anything).

At least, this is what it looks like from your own description. This is, probably, what most people do with it most of the time. And the weird corners will be found when they need to automate things, or when they want to deal with modular repositories, or history rewrites. These aren't everyday tasks / not for everyone on the team, but, these things do happen, especially in smaller teams, where there's no dedicated infra person or group these can be delegated to.

replies(2): >>42945735 #>>42945736 #
7. kortilla ◴[] No.42945144{4}[source]
Maybe you’re young, but git is better than all of the other shit before it.

Try to come up with something simpler than git, and you’ll end up with something like SVN or CVS that struggled with more than a couple of people working on the same files.

Try to make something that is more content aware, and you’ll find out how git got its name in the first place.

replies(3): >>42945486 #>>42945638 #>>42995450 #
8. nextaccountic ◴[] No.42945486{5}[source]
Mercurial is simpler than git. It is (or was) just too damn slow
replies(1): >>42947706 #
9. maccard ◴[] No.42945638{5}[source]
Mercurial and perforce are a better solution for anything with a centralised repo IMO
10. maccard ◴[] No.42945735{4}[source]
If the tool is designed to support the use case of the 1% with concessions for the other 99%, the tool is badly designed.

Git is designed for the case where you have multiple remotes with no central authority. Except that’s not how any project I’ve _ever_ worked on functions in reality. It makes sense for some applications, but if I say that I run Linux, there’s an assumption that I’m running something compiled from https://github.com/torvalds/linux - I.e. there is a central space.

I’ve used git and perforce in anger for a decade, in teams of 1 to 150+ (with a brief blip in the middle where I tried plasticscm which was a mistake), and I’ve been the “git guy” on teams during that time. If git’s defaults were tweaked for “one origin, probably authoritative” and it had better authentication support out of the box it would be a significantly better experience for 99% of people. Those 1% of people who are left over are going to customise their config anyway, so make them add the distributed-defaults=true flag and the rest of us can get on with our work.

11. sampullman ◴[] No.42945736{4}[source]
I'm not totally sure what you mean by "non-automated" here, can you clarify? I have managed repos for small teams, that's actually the majority of my experience with it.

I do deal with multiple remotes quite often and haven't encountered issues. You're right about submodules, I avoid setting up projects with them, even at the expense of more manual work or complicated automation.

I'm definitely not using it as a substitute for rsync - I do prefer to put rules in place to avoid editing (shared) history, for obvious reasons.

replies(1): >>42949282 #
12. rtldg ◴[] No.42946334[source]
With 'gitk' I'm not sure I'll ever have to learn how to use 'git log'. A Good Enough preinstalled GUI is too convenient
13. Izkata ◴[] No.42947706{6}[source]
For some people. Back when I only knew how to use subversion, I tried out both git and mercurial, and found mercurial confusing while git clicked immediately.

Unfortunately it's been long enough I don't remember details why, just that it was something with how it handled branches.

replies(1): >>42967251 #
14. crabbone ◴[] No.42949282{5}[source]
> non-automated

Here are some examples:

We have some repositories that are created and maintaned by scripts, mostly for CI purposes. The scripts have to deal with various aspects of how checkouts, commits, automatic rebases etc. are done. For example, I had to write a script that automates "git-rebase -i" (simulating the editor, parsing the contents of the file that git generates in order to configure the rebase etc.)

Another example: generating various statistics for the repository (again, automatically). This is something we used to do to analyze the situation with build servers: how many do we need, how to load-balance them etc.

Another example: automated builds, where the build system needs to integrate with Git, extracting necessary info, rebasing, committing, parsing commit messages for guidance etc.

> rsync

What I mean by this is that most programmers use Git as an append-only database. And, by and large, aren't bothered by the state of the history, never utilize the history for anything. As long as they are all able to access the source code in some sort of sane state, they are fine.

This creates a lot of problems for the automation / infra / release people because they want history to have certain properties, which are lost if it's treated as append-only log, but usually our pleas are ignored if they are even heard.

replies(1): >>42952059 #
15. sampullman ◴[] No.42952059{6}[source]
Hm, I think you've mischaracterized me then. I do plenty of funny stuff with git in CI, but am usually able stick to modifying the repo in the way humans do. Maybe this is why I've mostly avoided edge cases over the years.

Though I have to say, for your examples (generating statistics and automated builds), read-only operations generally suffice for me, aside from pushing tags. I prefer to implement pull-based deployment if possible, and only allow release branches to fast-forward.

16. capitainenemo ◴[] No.42967251{7}[source]
Mercurial has both "real" branches (history is kept so you can always tell what revisions were in what branch) as well as git "branch is just a pointer tag"

So really you can choose whatever suits your needs.

Personally the things I love about mercurial are:

    more consistent commandline (that's the simple part others bring up)
    revsets (awesome query language for revisions, there's also filesets, but I don't use that as much)
    absorb  (I think someone added a git extension that does something similar a few months ago)
    fa --deleted 
    grep --all  
    phases ♥