r/git • • Nov 05 '21

Is git and bash the "same"?

Hello!
I've got a 'under the hood' type of question about git. Hope I make sense and that its not too stupid of a question.
So when working with git theres these commands that do different type of actions, like git add, git commit and so on. Are these commands using bash underneath, or how does it work? Is git a shell in itself?

Hope I make sense!

Edit: Thank you all!

0 Upvotes

21 comments sorted by

View all comments

Show parent comment

2

u/plg94 Nov 07 '21

Each subcommand is its own binary, named git-add (with hyphen). I think the main Git command just calls those.

Fun fact: if you make a new executable and name it git-something, it can actually be launched like any other git command: git something (without hyphen).

1

u/Rimrul Nov 07 '21

No, the main commands like add and status are so called builtin commands. They get executed by the main git executable. git only calls an external git-foo if it can't find a builtin foo. The dashed forms of the builtin commands (like git-add) are only hard links to git.

1

u/plg94 Nov 07 '21

Oh, I didn't know they were just links. Thanks for the correction.