this post was submitted on 13 Dec 2023
478 points (94.1% liked)

Programmer Humor

19817 readers
936 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 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 36 points 1 year ago* (last edited 1 year ago) (2 children)

I don't understand git anyway

[–] [email protected] 69 points 1 year ago (1 children)

Well, you learn four commands and hope for the best.

[–] [email protected] 17 points 1 year ago (2 children)

fetch, reset --hard, checkout -b and cherry-pick?

:-D

[–] [email protected] 13 points 1 year ago (2 children)

Nah, rebase -i, squash, fsck and reflog

[–] [email protected] 11 points 1 year ago* (last edited 1 year ago) (1 children)

Must be an interesting work if you never add, commit or push.

Edit: How the hell did you get the repo without clone?

[–] [email protected] 11 points 1 year ago (1 children)

Pshaw, real programmers write out the contents of .git by hand.

(Also, it was a joke, the last two commands I listed are ones you'll ideally never need in your life)

[–] overcast5348 3 points 1 year ago

I was scared of reflog too. Had to use it for the first time recently after I accidentally'd a branch that I hadn't pushed to remote yet. I was so glad that I could recover it all in <5 commands.

[–] [email protected] 5 points 1 year ago (1 children)

reflog saved my life once after a stupid misshap.

All rebase are belong to us (onto, rebase, and ofc interactive) but what's fsck (I don't squash personally)?

[–] [email protected] 4 points 1 year ago

Fsck is File System Check - realistically you should never need to use it.

[–] [email protected] 10 points 1 year ago* (last edited 1 year ago) (1 children)

More like clone, pull, commit, and push --force

>:-D

[–] [email protected] 3 points 1 year ago

push origin head

^^

[–] [email protected] 53 points 1 year ago (1 children)

Title text: If that doesn't fix it, git.txt contains the phone number of a friend of mine who understands git. Just wait through a few minutes of 'It's really pretty simple, just think of branches as...' and eventually you'll learn the commands that will fix everything.

[–] [email protected] 10 points 1 year ago
  • git pull

  • git add *

  • git commit -m "Some stuff"

  • git push

And occasionally when you mess up

  • git reflog

  • git reset HEAD@{n} (where n is where you wanna roll back to)

And occasionally if you mess up so hard you give up

  • git reset --hard origin/main

And there you go. You are now a master at using git. Try not to mess up.