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)
  • @Phoenix3875
    link
    5
    edit-2
    10 hours ago

    In recent git versions (>2.23), git restore and git restore --staged are the preferred ways to discard changes in the working tree (git checkout -- .) and staged changes (git reset --) respectively.

    • @[email protected]OP
      link
      fedilink
      2
      edit-2
      8 hours ago

      Huh, TIL.

      To be fair, git switch was also derived from the features of git checkout in >2.23, but like git restore, the manual page warns that behavior may change, and neither are in my muscle memory (lmao).

      I’ll probably keep using checkout since it takes less kb in my head. Besides, we still have to use checkout for checking out a previous commit, even if I learn the more ergonomically appropriate switch and restore. No deprecation here so…

      edit: maybe I got that java 8 mindset

      • @bradboimler
        link
        English
        130 minutes ago

        Besides, we still have to use checkout for checking out a previous commit

        git switch works on commits too. I don’t think you have to use checkout anymore.