this post was submitted on 24 Sep 2024
557 points (99.1% liked)

Programming

17443 readers
252 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

Git cheat sheets are a dime-a-dozen but I think this one is awfully concise for its scope.

  • Visually covers branching (WITH the commands -- rebasing the current branch can be confusing for the unfamiliar)
  • Covers reflog
  • Literally almost identical to how I use git (most sheets are either Too Much or Too Little)
you are viewing a single comment's thread
view the rest of the comments
[–] fool@programming.dev 4 points 1 month ago* (last edited 1 month ago)

Click to view diffs is super ergonomic; on the other hand, I actually have a story about the Git CLI trumping the GUI (spoiler: reflog).

In high school we had gotten the funding to build a robot, and one of the adults in charge -- guy was brilliant -- was using GitHub Desktop to conduct a feature merge with the student who served as team lead. The thing was, he was used to older codebases, so all of his experience was with CVS instead of Git -- so when the two slightly messed up the git merge, they discussed recloning everything instead of wasting time plumbing the error (relevant xkcd).

That was one of the earliest times I had the cajones to walk up to a superior and say "No, you're doing this totally wrong. You don't have to do that."

He looked at me and nodded. "What would you do instead?"

"Reflog."

"Reflog? I've never heard of it before. Can you show us?"

I hopped onto the laptop and clicked around GitHub Desktop, but couldn't manage to find any buttons related to reflog... so I went straight to cmd.exe instead.

git reflog
git reset --hard "HEAD@{7}"

"Done. We can continue rebasing."

And after that, the advisor complimented me for using the command line tool!

"Lots of GUI apps are just limited frontends to the real meat and potatoes, the command line. Nice job!"

I felt like a wizard! And so I became the team's Git-inator.

edit: pruned story