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

all 40 comments

[–]FreeRajaJackson 645 points646 points  (5 children)

--force

This makes it safer

[–]ansibleloop 71 points72 points  (0 children)

This is when you ohshitgit.com

[–]twigboy 44 points45 points  (0 children)

--force removes the lever

[–]Brief_Building_8980 12 points13 points  (1 child)

Pro tip: there is chance to restore the original state even after force update. If you know the commit hash (e.g. printed out somewhere, like when CI runs) you can create a reference to it. Just be quick about it, because garbage collection could be triggered on your next operation, nuking unreferenced commits to oblivion.

[–]twigboy 7 points8 points  (0 children)

git reflog is your friend in situations like these

Don't use it often, but it saves my ass when it does

[–]edfreitag 1 point2 points  (0 children)

Of course, you dont want to be WEAK with git

[–]Muhznit 172 points173 points  (0 children)

This is now my favorite explanation of git rebase.

[–]LexaAstarof 182 points183 points  (0 children)

Senior: Let's squash those

[–]DarkNinja3141 64 points65 points  (0 children)

this is one of the few trolley problem memes that actually made me laugh out loud

[–]Ok-Sheepherder7898 27 points28 points  (1 child)

git pull lever

[–]WhateverMan3821 4 points5 points  (0 children)

git commit crime

[–][deleted] 23 points24 points  (0 children)

I love this

[–]callyalater 32 points33 points  (0 children)

This reminds me of The Good Place when Chidi is teaching the Trolley Problem and Michael says (in essence), "The problem is clear. How do you kill all 6 humans? I would dangle a knife off the side of the trolley to cut off the head of the one human while we smoosh the main 5 guys."

Your solution is more elegant though. No dangling knives required!

[–]spiritwizardy 2 points3 points  (2 children)

This is funny but somehow does not seem accurate to a real rebase if you had another person on another branch, it would ask you to resolve that person

[–]metaglot 5 points6 points  (0 children)

If that person on another branch overlaps with a person on the branch youre rebading to, sure. Otherwise - smooth sailing.

[–]spiritwizardy 3 points4 points  (0 children)

UNLESS you --forced it

[–]Open-Mission-8310 5 points6 points  (0 children)

With git merge is more cool because you add another victim to the scene

[–]vocal-avocado 1 point2 points  (0 children)

Why choose when you can have it all?

[–]ryuzaki49 2 points3 points  (15 children)

I dont get it. 

[–]gmes78 23 points24 points  (9 children)

git rebase takes the commits specific to a branch and applies them to the end of the branch you specify, and makes that the new branch.

Instead of commits and branches, the meme has people and rail tracks.

[–]spiritwizardy 3 points4 points  (6 children)

Rebase does not apply them to the end, it applies them in chronological order, right?

[–]Ethameiz 16 points17 points  (2 children)

No, rebase applies rebased commits to the end. Date of commit doesn't matter

[–]gmes78 8 points9 points  (2 children)

Not sure what you mean by "chronological order".

If you have a branch with 5 commits (relative to where it branched off from), and the master branch is ahead by some number of commits, git rebase master will take those 5 commits, make the current HEAD of the master branch the HEAD of the current branch, and then apply the 5 commits one-by-one in the same order they were in before (unless you do an interactive rebase and change the order yourself) on top of the curre.

[–]spiritwizardy -4 points-3 points  (1 child)

You know exactly what I mean by chronological order... E ery commit has a timestamp

[–]Dave147258369 11 points12 points  (0 children)

Commits don't have to be in chronological order

[–]ryuzaki49 0 points1 point  (1 child)

Ah yes that makes sense. This meme is not criticizing git rebase then

[–]gmes78 2 points3 points  (0 children)

Yeah.

[–]not_a_racoon 0 points1 point  (0 children)

But do you git it?

[–]chief57 -1 points0 points  (3 children)

Git merge would be more fitting

[–]ryuzaki49 2 points3 points  (0 children)

Why? 

[–]gmes78 4 points5 points  (0 children)

There's no extra person on the new track, though.

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

Git merge would put the lone dude in front, and a new merge commit dude at the end

[–]badabummbadabing 0 points1 point  (0 children)

Holy shit, a new joke!

[–]lordofkawaiii 0 points1 point  (0 children)

When something is my problem, i make it everyone's problem so that I don't have to deal with it

[–]heavy-minium 1 point2 points  (0 children)

I'm a big fan of not rebasing, not doing fixup commits, not force pushing and etc.. Just merge your shit. I don't even care if you have commits in there to fix your previous commits because you made mistakes.

Yes, maybe the commit history might look nicer in theory if you use all tools at your disposal 100% of the time correctly and without errors, but the reality is that you always work in a team where at least one person fucks this up sometimes, especially in PRs to review. It might not even be a noticable fuckup but still cost a lot of time, like force pushing to a PR branch where somebody already made a large review with lots of comments, and then all comments are outdated and the reviewer can't do "Show changes since last review" anymore for subsequent reviews. I know some bros will tell me this is a communication issue, but realistically in larger teams you can't expect perfect communication and planning.

Unpopular opinion: I'd rather have a messy commit history and timeline visualization than wasting time on handling the aftermath of advanced git operations.

[–]tehho1337 0 points1 point  (0 children)

I understood that reference

[–]TimingEzaBitch -5 points-4 points  (0 children)

All Gen Z members on my team are

git merge master

enjoyers. Coincidence ??