a git cheat sheet

really appreciated everyone's suggestions on the previous thread! https://social.jvns.ca/@b0rk/112276852440106066

I only included things that I actually do in the cheat sheet (with a couple of exceptions like `git push -u`, which I only don't use because I have `push.autoSetupRemote true` configured) but there are a lot of other useful-looking tips in that thread that I don't personally use

Julia Evans (@[email protected])

Attached: 1 image working on a draft of a git cheat sheet, what's missing? most interested in relatively "basic" things in git that you always forget how to do. Right now I think the push/pull section is by far the weakest

Mastodon
the only other things in this cheat sheet that I personally don't use are `git switch` and `git restore`, which I actually think seem like great choices (the fact that `git checkout THING` just GUESSES if you want to switch to a branch or restore an old version of the file is kind of scary! git switch doesn't do that! and git checkout's syntax is just really weird!), but I'm used to `git checkout` and it doesn't cause me a lot of problems so I haven't been motivated to change my ways

@b0rk I use git switch -C mybranch to automatically switch to the branch and reset it so that it's current. But when I want to reset a file back to what's in the repo, git checkout -- /path/to/file.

Guess I only made it halfway to the less overloaded commands 😂

@dade
That's the opposite of what I do. I use restore because git warned me to do so when I used the usual checkout. However creating or changing braches I still do with checkout   

When ever I have to push or pull I do that with remote and branch. I stopped using git push -u, as it made it too easy for me to keep pushing to wrong branches, like main in stead of feature or stupid stuff like that.
@b0rk