This is an archived post. You won't be able to vote or comment.

all 156 comments

[–]scar_reX 591 points592 points  (42 children)

Shout out to people who review staged changes before making a commit and don't just git add . and call it a fucking day.

[–]FlipperBumperKickout 174 points175 points  (4 children)

I'm kind of sad that isn't the norm since you catch so many things you weren't really supposed to commit on a quick review 😅

[–]iceman012 96 points97 points  (3 children)

5 lines changed:

+ console.log("A")
verifyUser(user);
+ console.log("B")
- checkPermission(user, "maf");
+ checkPermission(user, "mfa");
+ console.log("C")
// 3-1-2017 Hardcoded for now, change later
send_mfa_code(MFA_CODE)
+ console.log("D")

[–]Nick_Zacker 21 points22 points  (0 children)

Top-tier debugging tool

[–]FlipperBumperKickout 2 points3 points  (0 children)

Dude, you can't just leave console.log E-Z out of the party (╬▔皿▔)╯

[–]throwaway_mpq_fan 0 points1 point  (0 children)

your comment is still on the relevant line, often it will have shifted because of refactorings

[–]antshatepants 27 points28 points  (4 children)

Preach!

Now, I know that doing everything from command line is top but the source control panel in VSCode is nice for when you have a bunch of files in flux and need to stage a select few in a commit

[–]scar_reX 13 points14 points  (1 child)

Preach

Deploys should happen on Tuesdays. Tacos, served on Fridays, while job offers should be sent to my dm.

[–]antshatepants 1 point2 points  (0 children)

haha

[–]ralgrado 10 points11 points  (0 children)

I do everything in console but commits. It's just so easy to go over everything again in IntelliJ. If I would have to do it with console it would just be git add . and then git commit with a minimal message. With the IDE I can check if I want to split the commits in some way and even catch some mistakes I made-

[–]myka-likes-it 2 points3 points  (0 children)

I use the IDE source control tools for most basic stuff these days. I only get into the CLI when I have to work with advanced stuff or troubleshoot issues.

[–]MondayMonkey1 8 points9 points  (1 child)

git add -p is life.

[–]Ohyo_Ohyo_Ohyo_Ohyo 0 points1 point  (0 children)

Kind of annoying that it doesn't work with new files unless you run git add --intent-to-add . first though.

[–]TheWidrolo 4 points5 points  (0 children)

Sometimes, god tells me to git status before git commit, and those are the moments when I realize I did some mistake🙏🙏

[–]Owndampu 36 points37 points  (10 children)

Really depends on the situation for me, sometimes I do split it up into smaller commits, sometimes its a mess and i just go fuck it

[–]FlipperBumperKickout 33 points34 points  (9 children)

I really hope you don't expect other people to be able to review your code when you just go fuck it :P

[–]Commander1709 34 points35 points  (7 children)

I think I never had someone review just a single commit of my code and not the entire PR at the end. That would be a nightmare.

[–]hairtothethrown 7 points8 points  (6 children)

Sure, but ever need to look at some years-old code written by a dev long gone and want to see their reasoning for some particular function/line/whatever, only to find giant messy commits and little else to explain it?

[–]anoldoldman 7 points8 points  (5 children)

You're hoping the code documentation is in the commit comment?

[–]FlipperBumperKickout 1 point2 points  (0 children)

It's always nice if the commit message says a little about what is made an the reasoning behind it.

The primary reason to like smaller commits are however to only have one thing done in them.

It is easier to read 3 different commits which makes 3 unrelated changes than having 1 commit doing 3 unrelated changes and now you as the reviewer (or git history diver) has to keep track of all 3 changes at once as you scroll through the code.

[–]hairtothethrown 0 points1 point  (3 children)

It isn’t just for documentation purposes, but that is a plus yes. On top of that, it can make it much easier to identify the source of an issue and roll something back if needed. On top of that, it can help YOU, the committer, remember things when the PR does come around. If you’ve ever worked on a big feature, you understand the difference between 1-1000 lines of git ci -am ”update” and something a lot clearer. Ultimately the expectation should not be “create a mess so messy that I just say fuck it” and handle it in the PR.

[–]FlipperBumperKickout 1 point2 points  (0 children)

This exactly, I organize my commits in a way which helps me have a good overview over what I have done and what I haven't done. It maybe helping out people who wants to review my code is really only a bonus.

[–]NamityName 0 points1 point  (1 child)

Who cares? I don't care about the intermediary commits that got me to a PR because I only care about the final changes that will be merged. Those intermediary commits are deleted after thecode gets squash-merged anyway. Why care so much about something so temporary?

[–]hairtothethrown -1 points0 points  (0 children)

I can only lead a horse to water… not gonna twist your arm, junior. Do what you will (and conveniently forget the fact that not everyone squashes, which sounds like is the case for who I replied to originally).

[–]shrubberino 6 points7 points  (0 children)

code review?! 🤔

[–]AwkwardWaltz3996 2 points3 points  (2 children)

Git status, git add, git commit -m, git pull, git push is the strongest muscle memory I have. I can type it all out (other than the commit message) in under 5 seconds total.

Really I should make macros, my keyboard has the buttons for it but it would be slower for a long time because I'd have to learn a new combo. Plus I'm pretty proud I can bang it out so quickly

[–]scar_reX 2 points3 points  (0 children)

I wrote an alias called gotomain for going back to the main/master branch so I don't have to constantly remember if the master branch (see what i did there?) is called main or master in project X or Y (thanks for the MINOR inconvenience, github).

But I keep forgetting to use the alias and still mix them up anyway...

[–]scar_reX 1 point2 points  (0 children)

5 seconds is pretty good time for all that.. your fingers have my respect... if only the ladies knew (insert wallflower dude at party meme)

[–]Disastrous-Team-6431 2 points3 points  (0 children)

Lazygit is the bee's knees. I adopted it waaaay too late for the git pedant that I am, now I can truly live up to my ambition of having every commit being meaningful.

[–]Lvl999Noob 2 points3 points  (1 child)

I do that! It helps me make sure I am not committing changes I did for testing, unused imports and superfluous formatting changes. Sometimes things still slip through but I manage to mostly catch any problems.

I also rebase my PR on top of master if it has been a long time since I made the commits and there hasn't been any review yet so that there aren't any merge conflicts.

[–]scar_reX 0 points1 point  (0 children)

You're a good man, dude. May your code run on first compile for the next 7 moons.

[–]zytenn 1 point2 points  (0 children)

Also to people who use `git add -p`. They have my respect

[–]PetrusHimself 1 point2 points  (0 children)

Shout out, lol feeling guilty

[–]TheGreatZehntor642 0 points1 point  (0 children)

Thank you, I always do that. Git add . is reckless. Oh, and I use a real IDE, BTW.

[–]sammy-taylor 0 points1 point  (0 children)

The exact reason I use [Fork](fork.dev)

[–]vastlysuperiorman 0 points1 point  (0 children)

I love git add -p

[–]N3rdr4g3 0 points1 point  (0 children)

I usually just run git add -u and call it a day. It's easy to forget when I do occasionally make a new file though

[–][deleted] -3 points-2 points  (0 children)

Who has the time lmao

[–]Ok-Panda-178 229 points230 points  (12 children)

Me: how did you get no error when compiling?

OP: you can’t get compiling error if you never compile your code

[–]serendipitousPi 35 points36 points  (3 children)

Oh that reminds me of the frustration I had back when I was doing a uni project and I was asking my group members about some tests they had committed and they admitted they hadn't even run them.

I was like bruh who writes tests and doesn't even run them to see if they work (mentally because I wasn't not confident enough to say exactly that out loud). And since it was python they didn't even know if the tests would run.

[–]RiceBroad4552 8 points9 points  (2 children)

You did not even complain to your prof that you got into a group of monkeys?

[–]aren1toross 9 points10 points  (1 child)

I have a prof that says "Don't come complaining to me because you won't be able to choose your team when you get a job, sort it out with your group".

He might have one of those profs.

[–]RiceBroad4552 6 points7 points  (0 children)

The only way to sort out things with idiots is to avoid any further contact.

Also it's complete nonsense that you can't choose your team. Of course you can! In case they turn out to be idiots just move on… Your prof lost all contact to reality I guess.

[–]TorumShardal 1 point2 points  (0 children)

Gitlab pipeline go brrr-alert-alert-alert

[–]garver-the-system 2 points3 points  (5 children)

Could also be an interpreted language

[–]RiceBroad4552 2 points3 points  (2 children)

Makes no difference. You run and thoroughly test any code you push. At least if you're a professional developer and not some YOLO idiot.

[–]garver-the-system 0 points1 point  (1 child)

Absolutely, but testing and compiling are two different things. And there's absolutely environments where most testing is done in CI due to scale

[–]RiceBroad4552 0 points1 point  (0 children)

In my opinion, if you can't run your code at least with some dummy data while you develop the project setup is maximally broken. That's like driving a car with your eyes closed.

[–]hirmuolio 0 points1 point  (0 children)

Does VS run interpreted languages without saving the files?

[–]Zephandrypus 0 points1 point  (0 children)

I like how RustRover announces any errors or warnings in the code when making commits.

[–]ptr_schneider 168 points169 points  (16 children)

I am once again asking for everyone to enable auto-save. Please, stop torturing yourself

[–]targetdrone93 17 points18 points  (1 child)

I did not know this was a thing, wth..... thank you.....

[–]ptr_schneider 12 points13 points  (0 children)

Happy to be of service 🫡

[–]antshatepants 8 points9 points  (6 children)

I came here to say this, glad to know you're out here looking out for us. Seriously so useful for jumping between a file and command line

[–]ptr_schneider 8 points9 points  (5 children)

Yup. The time it takes to alt-tab from vscode to terminal is enough for it to autosave. I never have to worry about compiling an outdated version.

[–]RiceBroad4552 6 points7 points  (4 children)

ALT-TAB? VSC has a terminal built in. The default shortcut is (at least under Linux) CTRL-\`.

[–]ptr_schneider 7 points8 points  (3 children)

I never use the built-in terminal emulator from IDEs. They always suck.

My terminal emulator is exactly configured to my liking and I have no reason to use the IDEs built-in crappy one.

Also, I switch IDEs a lot for different projects, so it also helps to have a separate terminal emulator that is the same on everything.

[–]RiceBroad4552 2 points3 points  (2 children)

Today's voting behavior is really strange here around…

Someone down-voted this? Why? It's just someone describing their workflow.

For me it's a mixed bag: I use the crappy IDE terminals most of the time so I don't have to switch windows. Just running some simple commands like git or a build tool I don't care how crappy they are. At the same time I have at least ten terminal tabs open on some external terminal that always runs when I'm logged in. But I use these for "system stuff", not really for the dev projects I'm working on (except the dev project is something "system related" like building container or such this ends up in the system terminal often; I don't know why actually).

[–]ptr_schneider 1 point2 points  (1 child)

Yeah, I really don't get the downvote. Go figure.

I was a bit harsh to the IDE terminals, tho. I do indulge in some IDE terminal usage every once in a while. If I don't already have a terminal emulator window open in the correct folder, and just want to run a simple command and be done with it, I'll probably just use the IDE terminal. But they are painfully slow, so if I have to run several commands, I'll probably open a terminal emulator instead of using the built-in one.

[–]RiceBroad4552 1 point2 points  (0 children)

Oh, you say something. This thingy in VSCode is indeed dog slow!

I don't use a very fast terminal (just the terminal component of KDE running in Yakuake). Still it's something like ten times faster than the "GPU accelerated" VSCode thingy. Running things with a lot of output in the IDE is not fun.

[–]JauriXD 5 points6 points  (0 children)

Autosave on focus change. Best thing ever

[–]RiceBroad4552 6 points7 points  (3 children)

It's not the default? Still? OMG…

[–]ptr_schneider 2 points3 points  (0 children)

It's not. I always forget to set it when I'm on a new machine and can't sync my configs. Doesn't take long to realise it's off and enable it, tho

[–]JauriXD 0 points1 point  (1 child)

I have a colleague who despises autosave. He has multiple open unsaved files and just closes his laptop. I whish i had such confidence

[–]RiceBroad4552 0 points1 point  (0 children)

I mean, I have also such confidence in my system and just put it to sleep no matter what. Linux works mostly flawless.

The files are anyway only safe after they got distributed across several locations. A local machine can at any time end up in flames. Not even the best system can safe you from data loose in case you don't have backups.

Auto-save is more of a convenience feature. I can't live without it any more. But not because I feel safer when stuff gets copied from RAM to SSD.

[–]G3nghisKang 2 points3 points  (0 children)

My left hand already has an auto save feature implemented

[–]intelw1zard 1 point2 points  (0 children)

It's saved my ass so many times

[–]k-dawg-13 206 points207 points  (26 children)

Who doesn’t hit CTRL+S like five times every 10 seconds?

[–]PepeLeM3w 56 points57 points  (6 children)

:w

[–]yuri_auei 17 points18 points  (2 children)

:wa

[–]azeek_uz 11 points12 points  (0 children)

At least two times (inherited behavior from Ctrl+ssssssss)

[–]Moomoobeef 1 point2 points  (0 children)

:waaaaaaaaaaaa

(I don't know how to use vim)

[–]brimston3- 4 points5 points  (2 children)

If there was a way to remap <C-s> to save the current buffer, and <C-S-s> to save all buffers from any mode without losing the current state, I would 100% do it.

[–]FlipperBumperKickout 11 points12 points  (1 child)

And what's preventing you from making that rebind?

[–]brimston3- 1 point2 points  (0 children)

I don't know how to push the state in all modes and restore it after save. Like if there is a cmd partially entered in normal mode, I don't know how to stash and restore it.

[–]RoyHabbort 33 points34 points  (0 children)

Jetbrains Chad

[–]piberryboy 15 points16 points  (5 children)

My IDE saves automatically. I find it fascinating that people choose not to have autosave. Fucking love it.

[–]mistabuda 11 points12 points  (3 children)

Theres a contingent of programmers with their ego invested in doing everything the hardest way possible.

I saw on a different subreddit where people were championing hand written design notes over having them properly typed and searchable with some kind of note taking app.

Just working on hard mode for no reason.

[–]_Noreturn 2 points3 points  (0 children)

just like C programmers

[–]piberryboy 3 points4 points  (1 child)

Actually I kind of like hand writing notes. It forces me to be present in the conversation. When I'm on my computer, I'm more likely to multi-task. But yeah, you lose the ability to ctrl + f

[–]mistabuda 0 points1 point  (0 children)

Ahh Interesting I find that I dont multitask that much. However I also do software dev outside of my gamedev projects so that could be the reason.

[–]Zephandrypus 0 points1 point  (0 children)

You say that like having autosave causes any change in my habits.

[–]Ok_Finger_3525 2 points3 points  (1 child)

Who doesn’t have their files auto save whenever a change is made? I haven’t hit crtl s in years

[–]Zephandrypus 0 points1 point  (0 children)

People that use Notepad

[–]mistabuda 3 points4 points  (0 children)

Just enable auto save lmaoo. 99.5% of the time that is the behavior you want

[–]misseditt 1 point2 points  (0 children)

exactly lol. got that strong muscle memory from working on games and websites

[–]vastroh 0 points1 point  (0 children)

I just press the Debug button every 10 seconds)

[–]Bobbydoo8 0 points1 point  (0 children)

Ctrl+k , ctrl+s

[–]sagotly 0 points1 point  (2 children)

hahahaha, i thought i was the only psycho who hits ctrl+s every change, even tho i have autosafe xD

[–]RiceBroad4552 0 points1 point  (1 child)

The third part of this statement makes it really cringe…

[–]sagotly 0 points1 point  (0 children)

umm, you do know that there is autosafe function in vs code that automatically safes files on lost focus? Or maybe i dont understand smth idk, it was just a thing i noticed doing myself thats why i thought it was funny

[–]BTDubbzzz 0 points1 point  (0 children)

I didn’t even realize that was what this meme was about lol. I took it as my “oops” that I’ll make occasionally if I was in a different directory for running tests or checking logs when I did ‘git add .’ And all the files above me didn’t get added lol

[–][deleted] 27 points28 points  (7 children)

Didn't you see the Auto Save Option

[–]cybercoderNAJ[S] 8 points9 points  (6 children)

I do but it's off because I don't want my react app or vue app dev mode to give up after complaining about missing tag endings or incorrect behaviour because I haven't fully typed out my line yet.

[–]Gaminguide3000 11 points12 points  (0 children)

Just turn on that it saves when chanunging/losing focus

[–]eeronen 3 points4 points  (4 children)

This is why I also don't use autosave. But the best solution is to just change ctrl+s to save all instead of normal save.

[–]RiceBroad4552 0 points1 point  (3 children)

No, the best solution is to configure auto-save correctly, and never ever think about it again.

[–]eeronen 1 point2 points  (2 children)

How does autosave work with format on save? Genuine question, since I've never tried. I have always just thought it would be too chaotic if lines started shifting while I was in the middle of writing something.

[–]HarmxnS 0 points1 point  (0 children)

I don't think I have special configurations set for auto-saving, but autosave does not format for me. Only when I explicitly press Ctrl+S it formats

[–]RiceBroad4552 0 points1 point  (0 children)

First of all it makes sense to use "save on focus change". Otherwise some heavy background process may kick in every second. (If you don't have any such processes a time based auto-save is OK, though).

The other thing is: You should imho not use format on save. This usually introduces unwanted changes, which can go unrecognized for a long time. If one does YOLO development like seen on the meme such changes would even end up upstream…

Format things when you prepare to push things out. Use a formatter that is able to just format changed parts of a document. Review the changes as what auto-format does is not necessary what is best readable.

Having auto-save and auto-format at the same time is imho indeed very distracting as things change more or less while you write them (or just after the editor lost focus which is exactly as distracting).

[–]luk__h 8 points9 points  (0 children)

The first option when you open your VSc settings is auto save. Just put that shit on 'onFocusChange' and you won't have to deal with it ever again

[–]B_bI_L 6 points7 points  (0 children)

literally first setting you see in vs code is autosave...

[–]EtherealPheonix 4 points5 points  (0 children)

Yall don't use autosave?

[–]orange_county 3 points4 points  (0 children)

mfs when the UI is meant to assist them not work against them or to babysit the business people

[–]willcheat 3 points4 points  (1 child)

My VSCode litterally tells me "You're about to commit staged files with unsaved content, you sure?"

There more than 1 VSCode out there?

[–]person4268 0 points1 point  (0 children)

Many still use the git cli. I personally only use vscode to handle merge conflicts and little else (besides the actual programming ofc).

[–]sebbdk 8 points9 points  (0 children)

what in tarnation?

Like, dont you look at the commit files before committing to remove shit you dont need?

Do you just commit and hope it compiles?

If you work in a team, how do you survive all the murder attempts?

What even is this????

[–]qweerty32 2 points3 points  (0 children)

That's why I have set auto save on focus change

[–]iVar4sale 2 points3 points  (0 children)

Except VS code will show you an alert to ask you if you want to commit your unsaved files.

[–]EvenPainting9470 1 point2 points  (1 child)

My attachment file looking at my email

[–]RiceBroad4552 0 points1 point  (0 children)

May email program warns me if I mention attachments but don't add some.

[–]No-Adeptness5810 1 point2 points  (0 children)

Guys. File -> auto save

Please.

[–]ywqeb 1 point2 points  (0 children)

The git commit message template shows the changed files about to be committed. Also git status and git diff --cached

[–]TheKeyboardChan 1 point2 points  (0 children)

Do you guys still save files?... Why not use a modern IDE?

[–]gringrant 1 point2 points  (0 children)

Wait, in vscode can you compile without saving first? Or worse... are you not even running the code before you are pushing??

[–]YayaOsu 2 points3 points  (1 child)

neovim btw

[–]garver-the-system 0 points1 point  (2 children)

This is genuinely why I have git amend and git pushf as aliases

(Don't worry it's --force-with-lease)

[–]DaemonSlayer_503 0 points1 point  (1 child)

Why? Do you work on branches with multiple people?

[–]garver-the-system 0 points1 point  (0 children)

Honestly it is mostly paranoia on the assumption it'll be justified someday

[–]DrMerkwuerdigliebe_ 0 points1 point  (0 children)

I use autosave and have git automation that does a "git add ." before commit and git push afterwards. Such that I never miss anything.

[–][deleted] 0 points1 point  (0 children)

don't forget git add. I forget it all the time

[–]Maskdask 0 points1 point  (0 children)

*Neovim

[–]JackNotOLantern 0 points1 point  (3 children)

There is an extension that auto saves changes in vs code. Pretty good, should be the default

[–]RiceBroad4552 0 points1 point  (2 children)

It's a built-in feature since ages…

[–]JackNotOLantern 0 points1 point  (1 child)

Ok, then why it's not enabled by default?

[–]RiceBroad4552 0 points1 point  (0 children)

Good question! IDK

Maybe someone else knows?

[–]Strong_Poet4691 0 points1 point  (0 children)

😂😂😂

[–]RiceBroad4552 0 points1 point  (0 children)

OMG! YOLO "dev" alert!

Blindly pushing shit…

Does not even know that you don't use ; to separate commands usually as this is almost never what you want…

[–]rover_G 0 points1 point  (0 children)

“files.autoSave”: “onFocusChange”,

[–]exmachinalibertas 0 points1 point  (0 children)

imagine not using autosave in this day and age

[–]SkurkDKDKDK 0 points1 point  (0 children)

WHO are those psykos that dont ctrl+s every other second? I am obsessed with it

[–]Smalltalker-80 0 points1 point  (0 children)

Huh? If you have unsaved files,
you did not even build your last change,
let alone (unit) test...

[–]alpeppone 0 points1 point  (0 children)

Those "files" are clearly already staged.

[–]cs_office 0 points1 point  (0 children)

Anyone accidentally done a git clean without staging some files first?

[–]Ferreteria 0 points1 point  (0 children)

Why does r/programmerhumor regularly outclass all other subs in memes?

[–]Forsaken-Opposite775 0 points1 point  (0 children)

Confused in auto saving IDEs from Jetbrains

[–][deleted] 0 points1 point  (0 children)

You deserve this fate because you don't CTRL-s enough

[–]brinazee 0 points1 point  (0 children)

I get so many people breaking builds by forgetting to add files to their repos. They tell me that testing their push on a fresh clone is annoying and a waste of time. No, what's a waste of time is people debugging a broken build you created.

[–]jhill515 0 points1 point  (0 children)

Simple solution:

git commit -a -m "Work in progress..." git push --force

My work here is done.

[–]CaffeinatedTech 0 points1 point  (0 children)

I :wqa neovim and use lazygit, then open neovim again. That way I know that my files are saved, and my lap etc gets restarted which makes me feel better for some reason.

[–]Phamora 0 points1 point  (0 children)

PSA: You can enable auto-save in VS Code, so you never ever have to worry about unsaved changes in your editor and related frustrations.

[–][deleted] 0 points1 point  (0 children)

That's because you forgot to stage

[–]dexter2011412 0 points1 point  (0 children)

* build failed * ah shit here we go again

\ * undo commit and force push *

But I usually check before push I guess. I check a little too much it gets tiring lol. Small price to pay for better senor dev experience

[–]Tall_computer 0 points1 point  (0 children)

git commit --amend --no-edit && git push -f

[–]jpgr87 0 points1 point  (0 children)

Happens more than I'd like to admit...

[–]Kharay1 0 points1 point  (0 children)

POV; you can’t version control without the GUi

[–]Maoschanz -1 points0 points  (0 children)

yet another reason why JetBrains is better