Most active commenters
  • nomel(5)
  • behnamoh(3)

←back to thread

Oh Shit, Git?

(ohshitgit.com)
464 points Anon84 | 22 comments | | HN request time: 4.24s | source | bottom
1. behnamoh ◴[] No.42729165[source]
Git is one of those technologies that I never got to wrap my head around of, because in so many ways it doesn't follow intuition and unless you have been using it for a long time, for literally every action you would probably have to Google or use the man page of the command.
replies(4): >>42729343 #>>42729639 #>>42729962 #>>42733024 #
2. nomel ◴[] No.42729343[source]
I was trying to delete a file from history yesterday.

The built in way (filter-branch) pops up a warning, with a long delay, saying you should hit Control+C and go download a third party python script called filter-repo...

replies(1): >>42729380 #
3. PaulDavisThe1st ◴[] No.42729380[source]
Possibly consider that "deleting a file from history" is rather far outside the norm or recommended practice for git (even though it is, of course, entirely possible)
replies(1): >>42729476 #
4. nomel ◴[] No.42729476{3}[source]
> even though it is, of course, entirely possible

I take the more realistic perspective: until git makes it impossible to commit something that shouldn't have been, like a secret, then deleting a file from history is a fundamental requirement of git.

replies(2): >>42729598 #>>42730234 #
5. tom_ ◴[] No.42729598{4}[source]
The designers of git clearly disagreed, as you can guess from its design, so it's not surprising it might feel like a bit of an uphill struggle (and will probably remain so). There are other tools available.
replies(1): >>42786045 #
6. bitwize ◴[] No.42729639[source]
It's ok mate. Hackernews says we should be using jj to manage our rewritten-in-Rust code.
replies(2): >>42729737 #>>42729830 #
7. behnamoh ◴[] No.42729737[source]
Haha, I'm so glad I didn't fall for the whole rust thing.
replies(1): >>42731587 #
8. iimblack ◴[] No.42729830[source]
Since you brought it up, I personally switched to jujutsu and prefer it greatly. I regularly help coworkers deal with issues in git and keep dropping hints like `in jujutsu this would've been done way easier like this!`. Nobody bites yet since I think most of them don't want to use the CLI but maybe someday if enough people keep talking about it the inertia will get to the point that we can get some really slick GUIs for jj.
9. dmd ◴[] No.42729962[source]
As everyone knows, though, Git gets easier once you understand branches are homeomorphic endofunctors mapping submanifolds of a Hilbert space.
replies(4): >>42730306 #>>42730623 #>>42730749 #>>42732275 #
10. lcnPylGDnU4H9OF ◴[] No.42730234{4}[source]
Even if you purge the history, the secret is compromised and you should stop using it. It's moot whether or not you're able to remove it from history.
replies(1): >>42741430 #
11. wbl ◴[] No.42730306[source]
That's the Darcs joke and you told it somewhat incorrectly.
12. behnamoh ◴[] No.42730623[source]
Oh geez now that clarifies everything, how could I miss that?
13. jimbokun ◴[] No.42730749[source]
> homeomorphic endofunctors mapping submanifolds of a Hilbert space

Has to be easier to understand that then all the arbitrary git commands.

replies(1): >>42731336 #
14. sampo ◴[] No.42731336{3}[source]
Git commands, while they may be cryptic, actually mean something. Whereas that was just gibberish made by putting random mathematical words together.

(There is a similar sounding joke about category theory, "A monad is just a monoid in the category of endofunctors" but this sentence has a mathematical meaning.)

15. stouset ◴[] No.42731587{3}[source]
Both you and GP, please aim higher for comments on HN.
replies(1): >>42733495 #
16. riwsky ◴[] No.42732275[source]
Unless you’re in a detached HEAD, in which case it’s xylomorphic to the left-aligned Galois group of R^3.
17. stephen_g ◴[] No.42733024[source]
Did you start with Git or have you used other VCS systems before? I started with SVN and then coming to Git, there were obviously things to learn about how it was different but honestly it felt to me like it made things easier in many ways (since I'd experienced the horror of a very large codebase in SVN with lots of branches, and trying to track those and merge back together - git is so much better at that, it's crazy)...

I can see how it would be a much bigger learning curve if people come straight to git, but it's still hard for me to understand where the blocker is that so many people complain about using it...

18. ◴[] No.42733495{4}[source]
19. nomel ◴[] No.42741430{5}[source]
That's, for secrets. Secrets aren't the only thing one might want to remove retroactively.
20. nomel ◴[] No.42786045{5}[source]
> The designers of git clearly disagreed

filter-branch has been around since, at least, 1.8. It exists to rewrite history, this specific use case (as the official documentation details) included. An open source project admitting that a solution is better than their own does not mean the developers "disagree" with it, especially when the functionality has already been part of the developers tool for over a decade.

replies(1): >>42788293 #
21. tom_ ◴[] No.42788293{6}[source]
But if they didn't disagree, they'd have designed a system that made removing things from remote history easy, rather than a complete pain in the ass that's basically impossible to make work usefully anyway. The whole thing runs largely based on commit hashes, and when you change history, all the commit hashes change, and... good luck. This behaviour has some useful properties but it's quite often not what you want. And that isn't how this sort of system inevitably has to work! - but git does anyway, and always has done.

(By comparison, if you want to delete something from the Perforce history, there is a command for that. You can remove individual revisions, leaving gaps in the history, or the whole thing.)

replies(1): >>42797309 #
22. nomel ◴[] No.42797309{7}[source]
> But if they didn't disagree, they'd have designed a system that made removing things from remote history easy

That's not how real world software development works, especially open source (built on volunteer time, usually for personal use, then shared). See X window system, javascript, etc. Git's foundation was built in 5 days as a side project [1][2]. There wasn't some committee, design reviews, etc with perfect foresight. A foundation was built, and built upon, that worked great for 97% of the use case, with the remaining 3%, including those pesky "real world use" quirks, not fitting so great. This is common in software development [3]. I don't think you can reasonably extract an "agree" or "disagree" developer opinion from the implementation of the feature, but since the filter-branch feature was added 18 years ago [4], two years from gits birth, time for those pesky "real world" scenarios to be revealed, I think "agree" is probably the more likely. "Probably should have made that a first class feature" isn't some impossible phrase...I know I've said it many times.

I would be interested in the history of it though. I think a git documentary would be friggin amazing.

[1] Linus mail: https://marc.info/?l=git&m=117254154130732#:~:text=So%20git%...

[2] Interview with Linus: https://www.linuxfoundation.org/blog/blog/10-years-of-git-an...

[3] https://en.wikipedia.org/wiki/Leaky_abstraction

[4] filter-branch patch: https://lore.kernel.org/git/Pine.LNX.4.64.0706030129110.4046...