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)
  • Kissaki
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    3 months ago

    git has 17 million options

    proof needed /s

    I wonder how many it actually is.

    • foolOP
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      3 months ago

      According to tab autocomplete…

      $ git
      zsh: do you wish to see all 141 possibilities (141 lines)?
      

      But what about the sub options?

      $ git clone https://github.com/git/git
      $ cd git/builtin
      # looking through source, options seem to be declared by OPT
      # except for if statements, OPT_END, bug checks, etc.
      $ grep -R OPT_ | grep --invert-match --count -E \
      "OPT_END|BUG_ON_OPT|if |PARSE_OPT|;$|struct|#define"
      1517
      

      Maybe 1500 or so?

      edit: Indeed, maybe this number is too low. git show has a huge amount of possibilities on its own, though some may be duplicates and rewords of others.

      $ git show --
      zsh: do you wish to see all 489 possibilities (163 lines)?
      $ man git-show | col -b | grep -E "^       -" --count
      98
      

      An attempt at naively parsing the manpages gives a larger number.

      $ man $(find /usr/share/man -name "git*") \
      | col -b | grep -E "^       -" -c 
      1849
      

      Numbers all over the place. I dunno.

      • Kissaki
        link
        fedilink
        English
        arrow-up
        3
        ·
        3 months ago

        That’s less than I expected. If there’s 141 commands that on average comes down to 10 per.