this post was submitted on 20 Nov 2024
856 points (97.5% liked)

Programmer Humor

19623 readers
2701 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
(page 3) 50 comments
sorted by: hot top controversial new old
[–] _____@lemm.ee 121 points 19 hours ago (11 children)

let's turn this into a constructive angle for future devs and current juniors: just learn git cli, I promise you it is much simpler than it seems.

all those memes about git having like a thousand commands are true, but you really will only use like 7 at most per month.

learn push, pull, merge, squash, stash, reset, im probably missing like one or two

I promise you again: it is much simpler than it seems. and you won't have to use these stupid git GUI things, and it will save you a hassle because you will know what commands you are running and what they do

short disclaimer: using git GUI is totally fine but low-key you are missing out on so much

[–] sour@feddit.org 67 points 18 hours ago (1 children)

im probably missing like one or two

commit. Lol

load more comments (1 replies)
[–] Piatro@programming.dev 11 points 14 hours ago

The main draw to the CLI for me is portability. I've been a dev for ten years now and used tons of different editors on different platforms and while each one had a different way to describe the changes, how to commit, or how to "sync" (shudder), the CLI hasn't changed. I didn't have to relearn a vital part of my workflow just because I wanted to try a different editor.

[–] Atlas_@lemmy.world 8 points 14 hours ago

For a first step you can get away with just add, commit, push, and pull. Maybe reset, but tbh using git like svn at first is fine.

Next branch, checkout and merge. At this point show, log, bisect and blame also start to be useful.

I'm not a fan of stash, and would instead recommend reflog and cherry-pick as the first two advanced commands to learn. Then rebase and squash.

[–] MajorasMaskForever@lemmy.world 18 points 18 hours ago (6 children)

Every time I mentor a dev on using git they insist so much on using some GUI. Even ones who are "proficient" take way longer to do any action than I can with cli. I had one dev who came from SVN land try and convince me that TortoiseGit was the only way to go

I died a little that day, and I never won her over to command line despite her coming to me kinda regularly to un-fuck her repository (still one of the best engineers I ever worked with and I honestly miss her... Just not her source control antics)

[–] Knock_Knock_Lemmy_In@lemmy.world 11 points 16 hours ago (3 children)

If I want to commit a selection of files, but not others, then I'm clicking boxes not typing filenames.

[–] ulterno@programming.dev 2 points 10 hours ago* (last edited 10 hours ago)

Did you not know?
You can simply select all files you want to commit, in the File Manager, Ctrl+C, then paste in the terminal and it will automatically add all those file names (full paths) separated with spaces at the cursor. At least in KDE: Dolphin -> zsh + Konsole it does.

And sure, it might look like 2 extra steps, but you will still be clicking around a lot in case of a GUI anyway.

I tend to just type partial filenames and use tab completions, which are also pretty configurable. And the only dissatisfaction I have rn, is that I don't have zsh module for completions with pascal case and snake case.

load more comments (2 replies)
[–] dh34d@lemmynsfw.com 3 points 12 hours ago (1 children)

Currently using Tortoise and SVN for the first time at my job, and I hate it.

load more comments (1 replies)
[–] Antiproton@programming.dev 12 points 17 hours ago (3 children)

The difference in speed is familiarity, not some inherent efficiency gain by typing commands into the cli.

load more comments (3 replies)
load more comments (3 replies)
load more comments (7 replies)
[–] ICastFist@programming.dev 4 points 11 hours ago (1 children)

Same account that complained about the christmas santa hat

load more comments (1 replies)
[–] Michal@programming.dev 5 points 12 hours ago (7 children)

If the files were already staged then git should have blobs in the git folder, so they should be recoverable.

load more comments (7 replies)
[–] mvirts@lemmy.world 39 points 17 hours ago

Obligatory mention of file recovery as an option if you get in this situation.I recommend testdisk but there are other more gui friendly options.

NTFS takes a relatively long time to destroy the data so chances of recovery are good on Windows.

[–] JackbyDev@programming.dev 52 points 18 hours ago

I fucking HATE when abstractions over git use cutesy names that git doesn't use.

[–] AnAmericanPotato@programming.dev 142 points 21 hours ago (8 children)

I feel bad for this kid. That really is a bad warning dialog. Nowhere does it say it's going to delete files. Anyone who thinks that's good design needs a break.

Half the replies are basically "This should be obvious if your past five years of life experience is similar to mine, and if it isn't then get fucked." Just adding insult to injury.

[–] Omega_Jimes@lemmy.ca 69 points 20 hours ago (5 children)

I'm not great at English, but "discard all changes" shouldn't ever mean "Delete".

[–] Michal@programming.dev 30 points 19 hours ago (4 children)

In the context of version control it does. Discarding a change that creates a file means deleting the file.

[–] thebestaquaman@lemmy.world 15 points 17 hours ago

If you have set up your staging area for a commit you may want to discard (unstage) changes from the staging area, as opposed to discarding changes in the working directory.

Of course, the difference between the two is obvious if you're using git CLI, but I can easily see someone using a GUI (and that maybe isn't too familiar with git) misunderstanding "discard" as "unstage".

Either way, what happened here indicates that all the files were somehow added to the VC, without having been committed first, or something like that, because git will not let you discard a file that is untracked, because that wouldn't make any sense. The fact that the GUI let this person delete a bunch of files without first committing them to the index is what makes this a terrible design choice, and also what makes the use of the word "discard" misleading.

load more comments (3 replies)
load more comments (4 replies)
[–] kehet@sopuli.xyz 4 points 13 hours ago

Came here to say this. No one deserves this, not even new programmers who try to learn things.

Some programming tools are really powerful compared to what new users are used to. If you come from the world of Microsoft Office and Apple whatever it's called, everything is saved automatically to cloud and there is some local backup file somewhere which you can just restore. Modern programs are designed to protect users against their own mistakes, and when suddenly that is taken away, it can be a jarring experience.

[–] cocobean@bookwormstory.social 42 points 20 hours ago (4 children)

Also, why not send them to the recycle bin? I never really thought about it before, but that does seem a reasonable UX improvement for this case

load more comments (4 replies)
load more comments (5 replies)
[–] LANIK2000@lemmy.world 32 points 18 hours ago (3 children)

Honestly no idea why someone would go around a completely unknown menu in a new unknown editor and randomly click things with caution completely out the window. Not having a copy or trying a blank project, not even reading any messages. I mean even if we don't know it's a nuke button, God knows what other edits it could do to your code without you knowing.

This goes beyond rookie mistake. This is something 12 year old me would do. Same with the issue page being 90% swear words.

[–] calcopiritus@lemmy.world 20 points 18 hours ago (5 children)

I don't even know why people ITT are blaming the IDE and completely ignoring this.

When you learn git, you do so on a dummy project, that has 5 files which are 10 characters long each.

An IDE is not made so you can't break things, it is tool, and it should let you do things. It's like complaining that Linux will let you delete your desktop environment. Some people actually want to delete your desktop environment. You can't remove that option just because someone can accidentally do it by ignoring all the warnings.

[–] thebestaquaman@lemmy.world 15 points 17 hours ago (3 children)

Got will not delete untracked files though, which is what happened here. If you want to discard changes to a file with git, you first have to commit the file to the index at some point, which means there's only ever so much damage an erroneous "git restore" or "git reset" can do. Specifically, neither of them will delete all the files in an existing project where VC has just been added.

[–] calcopiritus@lemmy.world 7 points 14 hours ago (2 children)

This user was not using git though, he was using vs code. That button doesn't say "git reset" it says "discard all changes". And btw, what it does is "git clean", which is something that git can do.

Just below the button there is a list of all the changes. In his case, there were 3000 changes of the type "file creation". Discarding a file creation can only be made one way: deleting the file.

Anyway, this user is presumably in his learning phase, I would not assume that he knows what git reset or git restore actually do.

[–] thebestaquaman@lemmy.world 1 points 9 hours ago

Fair enough, git clean does exist. However, if the button saying "discard all changes" is really a button that runs git clean, that's just a plain terrible design choice. git clean is "delete all untracked files", which is specifically not discarding changes, because there can be no changes to discard on an untracked file. Even talking about "changes" to an untracked file in VC context makes little sense, because the VC system doesn't know anything about any changes to the file, only whether it exists or not.

That's not even mentioning the fact that the option to "git clean" shows up as one of the easily accessible options in relation to a staging process. Especially if you're coming from the git CLI, you're likely to associate "discard changes" with "git restore".

[–] Hawk@lemmy.dbzer0.com 4 points 13 hours ago

In other IDEs this discards tracked changes, untracked files usually stay untouched.

In my opinion, it's a combination of user error and bad implementation here

load more comments (2 replies)
load more comments (4 replies)
[–] Cethin@lemmy.zip 14 points 17 hours ago (1 children)

This is a disease of GUIs. Most people are so used to having their hands held and being unable to make a mistake that when a GUI actually gives you the power to fuck up they don't expect it. I promise you, if this user was using the CLI, this wouldn't have happened as easily.

[–] Kbobabob@lemmy.world 7 points 13 hours ago (1 children)

I promise you, if this user ~~was using the CLI~~ backed up their files, this wouldn't have happened ~~as easily~~.

[–] Cethin@lemmy.zip 4 points 13 hours ago (1 children)

That too, but it seems like this was them attempting to back up their files. They just critically failed.

load more comments (1 replies)
[–] JackbyDev@programming.dev 17 points 18 hours ago (1 children)

Honestly no idea why editors give shit random names instead of using the terms git uses.

load more comments (1 replies)
[–] Korne127@lemmy.world 45 points 20 hours ago (2 children)

Poor guy basically did a git reset —hard HEAD without even a git repository

[–] GreenAppleTree@lemmy.world 10 points 14 hours ago

Even reset hard wouldn't delete untracked files. This was a complete overreach by the GUI, performing a clean (and likely a forced one, as git's requireForce defaults to true).

And they did rectify that eventually, giving a warning, and an option to simply reset. It's unfortunate this poor person had to be the trigger for that change.

load more comments (1 replies)
[–] AnUnusualRelic@lemmy.world 4 points 13 hours ago* (last edited 13 hours ago) (5 children)

Looks like windows should come with a dictionary.

"Huh, discard, I wonder what that does. Let's try it on all my work from the last six months"

Idiots gonna idiot...

load more comments (5 replies)
load more comments
view more: ‹ prev next ›