Live data from Hacker News

Beej's Guide to Git

beej.us

231–240 of 318 posts

Re: Beej's Guide to Git

#231
post #209

Earlier quoted context omitted.

I highly doubt tortoise or any tool can "break" a repo. This might be a sign that you don't understand git either. Now I'm sure it can lead to people who don't know what they're doing doing the wrong thing, but if they're allowed to push somewhere and make it someone else's problem, that's not their fault. They've been forced to use git, so there should be someone else who actually understands git.

“Break” doesn’t mean repo integrity corruption. It means that you try to merge a branch, and it shits itself with hundreds of conflicts that shouldn’t appear and/or has changes that may partially revert the progress made by other merges. if they're allowed to push somewhere and make it someone else's problem, that's not their fault What? This made zeroest sense of the day. Like, I should walk to their desk and check…

Usually people make pull requests.

Re: Beej's Guide to Git

#233

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.

I can make a 5 line HN comment explaining how to use git:

1. git clone

2. git checkout

3. git pull

4. git add + commit + push

5. git reset / rebase

Re: Beej's Guide to Git

#234
post #110

Earlier quoted context omitted.

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 --ne…

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 sta…

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.

Re: Beej's Guide to Git

#235
post #223

Oh my goodness, this is a huge treat. His class networking programming guide sits at one of my top books of all time. Well written, informative, concise, and legitimately get you to chuckle out loud at points. Edit: Does anyone know a good way to convert one of the HTML pages into an epub for reading on an ereader? The PDFs will definitely work, but wanted to see if anyone knew of any tools for HTML -> EPUB conversio…

> Does anyone know a good way to convert one of the HTML pages into an epub for reading on an ereader?

Try downloading the single-page html and coverting with pandoc:

pandoc index.html -o bla.epub

Maybe it needs some fine tuning, but the result seems good to me.

Re: Beej's Guide to Git

#236
post #209

Earlier quoted context omitted.

“Break” doesn’t mean repo integrity corruption. It means that you try to merge a branch, and it shits itself with hundreds of conflicts that shouldn’t appear and/or has changes that may partially revert the progress made by other merges. if they're allowed to push somewhere and make it someone else's problem, that's not their fault What? This made zeroest sense of the day. Like, I should walk to their desk and check…

Usually people make pull requests.

Yep, with a branch they pushed into. I guess you're ignoring the same context as another commenter elsewhere, probably because your workflow is restricted only to modes that git "supports".

Re: Beej's Guide to Git

#237
post #148
post #30

Hey all--if you find things wrong, post 'em. I'll clean 'em up. :) Love, Beej

Not wrong, but since you’re mentioning vim in the context of git, might be worth adding :cq as a way to exit with a non-zero status to prevent git from finishing the commit / operation.

TIL! The funny thing about Vim is that you can have used vi/Vim for 30+ years and still learn new things. I'll add this to the Vim appendix. Cheers!

Re: Beej's Guide to Git

#239
post #219

Earlier quoted context omitted.

Why does git get a free pass for shitty defaults but perforce doesn’t? Perforce long predates git, and the checkout operation (which can be done on save with any modern editor) fixes that immediately.

Have you actually used P4 in anger? Having to add P4 support to any script, sucks. Having to do a network operation when touching files, sucks. Many many many apps have no idea what p4 is and will never get p4 support. Git gets out of the way.

> Have you actually used P4 in anger?

Yes. I use it every day. I've ran P4 servers that serve hundreds of GBs per day globally with both commit edges and regular proxies. I've written batch scripts, bash scripts, and tooling in python, go and C# around it.

> Having to add P4 support to any script, sucks.

I disagree. It's no worse than adding git support to something. p4 zTag isn't the most elegant thing, but it works.

> Having to do a network operation when touching files, sucks.

Does it? Is it any worse than having to keep the entire history of every file locally on your machine, including any "large files?" And git-lfs as a solution to that means you're now coupled to wherever those files are stored. Making large submits to P4 isn't the nicest experience, but it sure beats paying that price every time you clone a repo IMO.

> Many many many apps have no idea what p4 is and will never get p4 support

In the same way that many people in this thread are blaming a git gui for a problem, "that's not P4's fault". I do agree it's shit though.

> Git gets out of the way.

Until it doesn't.

Re: Beej's Guide to Git

#240
post #98

> GitHub is a web-based front-end to Git. ¯\_(ツ)_/¯ 208 mentions of GitHub. 4 mentions of Gitea. 3 mentions of GitLab. Why is it so biased and why is it helping to continue to teach people to centralized git.

It seems that Beej built this guide to help his students. More of them are probably using Git and GitHub in anger than the other tools.
Post reply on HN