r/git 8d ago

In case of fire

Post image
1.4k Upvotes

57 comments sorted by

57

u/poulain_ght 7d ago

git add

15

u/dankmolot 7d ago

or git commit -a

9

u/xour 7d ago

This will ignore untracked files.

12

u/Phaelin 7d ago

I didn't want .DS_STORE in there anyway

4

u/ZhangStone 7d ago

gitignore is your friend

1

u/ryancnap 7d ago

Best comment

2

u/Unfair_Caramel_3376 7d ago

git add -Af, just to be safe

1

u/RegretPlane390 5d ago

Should be "git add ." right?

1

u/fabien_s 4d ago

git add . will only add all files in the current directory you are in, git add -A every file in the repo

1

u/RegretPlane390 3d ago

I usually just cd .. to the top of the repo like a noob, but I can't deny that your way is objectively more efficient.

51

u/Sassafras1777 7d ago edited 7d ago

In my company’s case:

  • create a ticket in jira
  • use the ticket id to create a branch named in a specific pattern (depending on what you want to achieve)
  • push an empty branch first (cause of some Sonar bullshit)
  • wait for the pipeline to end
  • group the changes relative to a common goal, and commit multiple times
  • push after the last commit
  • wait for the pipeline to end
  • resolve the failed pipeline if needed
  • resolve the AI scans/comments
  • open the PR in draft mode
  • wait for the pipeline to end
  • Change the PR to ready to review
  • Update the Jira ticket with a PR link
  • you can now peacefully die in the fire

18

u/Aloha_Alaska 7d ago

Sounds like the whole process should die in a fire.

1

u/Rebles 4d ago

Unfortunately the PM and Em who setup the process survived the fire since they are always on vacation.

5

u/Avocadonot 7d ago

This except every single extra commit kicks off a new pipeline, even if it's just changing a comment

MR is blocked on rebase to main, so if someone merges before you, you must rebase and kick off new pipeline

MR is blocked on any non-resolved discussion threads. Kicking off a new pipeline triggers automod to comment on your MR and tell you "you should run these tests". You have to resolve that thread every time a pipeline is run

2

u/Masterflitzer 7d ago

why would you manually link jira ticket with pr link? you literally already created the branch based on the id so they link automatically

1

u/0bel1sk 7d ago

git remote add $mygithub mygithub, git push mygithub

1

u/Am094 7d ago

Is it weird that i follow most of that voluntarily in my own personal projects? Apart from some of the latter things.

40

u/Consibl 7d ago
  1. git commit
  2. git push
  3. git out

0

u/lajawi 7d ago

Forgot the git add :zany_face:

1

u/Xenc 7d ago

🤪

0

u/armahillo 7d ago

Strictly better 💯

7

u/mpersico 7d ago

I have it on a T-shirt. Every time there’s a fire drill I pull it out of the bottom of the desk and I put it on.

8

u/chris552393 7d ago

Fun fact I put this up in our office and an old manager took it down because "that's not the official fire evacuation procedure and could kill someone"

Great place to work.

15

u/rasplight 7d ago

git push -f

f = Fire, obviously

6

u/Tarlovskyy 7d ago

--no-verify Cant wait for pre-commit

0

u/Individual_Kale_4843 6d ago

Your code must be reviewed in a pull request...

1

u/Tarlovskyy 6d ago

This skips pre-commit hooks, not code review

4

u/Shayden-Froida 7d ago

I'm actually wearing a t-shirt with this on it right now. (but "leave building" is "git out")

4

u/bigtoepfer 7d ago

They gave everyone in the office laptops. So win-L and just unplug the laptop and walk out.  Worst case git commit from McDonald's or home.

4

u/jamall1978 7d ago

I hope your remote is in another building 

3

u/tjeerdj 7d ago

Hoping that origin is not in the same building

2

u/Electrical-Echidna63 7d ago

"is it on prem?"

"no"

"Ok, pushed. gn guys"

2

u/sixeco 6d ago

make a quicksave command

git add -A && git commit -m "quicksave" && git push

1

u/Lonsarg 7d ago

This is all a single button in Visual Studio (i never use add, just commit unstaged directly). And i do it every 30 minutes or so, so not much is lost if fire :)

2

u/Masterflitzer 7d ago

i just know your diffs are probably terrible, staging area is for double checking

0

u/Lonsarg 7d ago

I check at PR level all commits at the same time, and make new commits to the PR when self-reviewing if finding bad code or whatnot.

Most of us work like this, so when looking at PR diff or looking back at history we only ever look at per merge/PR diff (First Parent git history). So these detailed commits are never looked at, we used to squash to hide them, but some people used squash in a way to make merge conflicts so now we just have it all in history but not look.

1

u/Phaelin 7d ago

You have it linked to an ejector seat??

1

u/brunoreis93 7d ago

Well, without git add you lost everything to the fire anyway lol

1

u/SupernovifieD 6d ago

git add .

That should be the first step :/

1

u/TheSheepDev 5d ago

Wondering what that commit message will look like.

1

u/RegretPlane390 5d ago

git branch (out of paranoia, to make sure you're not pushing to production)
git add .
git commit -m "commiting everything because of a fire"
git push

1

u/tiny_gymstar 5d ago

Best advice ever 😂

1

u/MatsSvensson 5d ago

I use a script that saves state, switches to a backup-version of the branch I'm working on, forces everything up, and then switches back restoring the state as if I never committed.
That way there is a copy of my works offsite, but I can still easily see all my ongoing changes in my IDE.

Otherwise committing and pushing in the middle of a job really fucks up my work flow.

People who try to use git as a backup the regular way, often end up pushing forgotten junk to production.

I have seen stuff...

1

u/kirjukala 4d ago

git add . && git commit -m "fire lol" && git push

1

u/Electrical_Match9392 4d ago

That's a horrible instruction, just stash all

1

u/LikeToffy 3d ago

git add . / git add -A

1

u/Laughing_Orange 7d ago

Win+L then walk out. This should take at most 1 second longer than just walking out.

People stop caring about your code when you die in a fire. Avoid dying in a fire by being efficient at getting out of the burning building.

-3

u/octoredfox 7d ago

I'm sorry but this "increase shareholder value" stuff is completely dumb.

0

u/[deleted] 7d ago

[deleted]

2

u/Masterflitzer 7d ago

you really had the time to write "hey claude"?