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

Programming

17484 readers
115 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 [email protected]



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
[–] [email protected] 4 points 1 month ago* (last edited 1 month ago) (1 children)

git has 17 million options

proof needed /s

I wonder how many it actually is.

[–] [email protected] 3 points 1 month ago* (last edited 1 month ago) (1 children)

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.

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

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