Live data from Hacker News

Things I wish everyone knew about Git (Part II)

blog.plover.com

51–60 of 148 posts

Re: Things I wish everyone knew about Git (Part II)

#51
post #28

Earlier quoted context omitted.

The idea of "merging into" has no meaning with git. You're merging two things into one. But saying that there are a master thing and a slave thing has no meanings.

Not true because commit parents are ordered. One of them is first - the main parent.

It's a detail. But for some people it looks like it changes everything.

Re: Things I wish everyone knew about Git (Part II)

#52

a colleague accidentally force pushed a stale branch to master and a weeks worth of work was potentially lost. That day git reflog helped and saved our jobs as we were contractors for a big Germany based client.

Always disable force pushes to trunk (if that feature is available, as it is on Github).

Re: Things I wish everyone knew about Git (Part II)

#53
post #45
post #35

I made a simple script below I find useful that commits current changes then automatically rebases and squashes it with the previous commit, preserving the previous commit message. I find it useful for a way to quickly save current changes before switching branches, or for easily backing up work before its worth making a new separate commit: git add --all git commit --fixup=HEAD~1 GIT_SEQUENCE_EDITOR="sed -i -re 's/^…

Isn't this the same as something like: git commit --all --amend With maybe a --no-edit thrown in?

You know what you're right, the command

  git commit --all --amend --no-edit
seems to do essentially the exact same thing, thanks!

Re: Things I wish everyone knew about Git (Part II)

#54
post #44

I said this in another comment recently about git, but I find it odd that even after a decade of using git as a mandatory part of my professional life, I'm still learning new things. That's maybe not a good sign about the usability of git. That `@{'3 days ago'}` thing? That's incredible. Why didn't I know about that 8 years ago? Why wasn't it obvious, intuitive to me that this was possible? git is brilliant and I lov…

GIT is just the new Regex. Everybody uses it, most have no clue how it works and just copy/pasts stuff from other places/repeats the same little trick

Re: Things I wish everyone knew about Git (Part II)

#56
post #16

I love this quote from Part I: "Git has an elegant and powerful underlying model based on a few simple concepts: 1. Commits are immutable snapshots of the repository 2. Branches are named sequences of commits 3. Every object has a unique ID, derived from its content Built atop this elegant system is a flaming trash pile. "

So, like Nix, basically... ;)

Re: Things I wish everyone knew about Git (Part II)

#57
post #54
post #44

I said this in another comment recently about git, but I find it odd that even after a decade of using git as a mandatory part of my professional life, I'm still learning new things. That's maybe not a good sign about the usability of git. That `@{'3 days ago'}` thing? That's incredible. Why didn't I know about that 8 years ago? Why wasn't it obvious, intuitive to me that this was possible? git is brilliant and I lov…

GIT is just the new Regex. Everybody uses it, most have no clue how it works and just copy/pasts stuff from other places/repeats the same little trick

No, that’s terrifyingly untrue.

Git is more like… the new car. It’s complicated and most people have no idea how it works, but they know how to steer very simply and can drive it with a bit of training. Experienced people however, who know how cars work, can do really cool things with them and have no problem repairing them on their own.

Still, cars are useful. A bike would be better of course.

Post reply on HN