Pacman installs packages from only the repos.
Yay installs packages from both the repos and the AUR.
You shouldn’t generally be using git to install packages. This one is a little vague because git can be used to download data from a remote repo so it has a lot of different uses.
I generally use yay/paru to install and update packages.
In case it wasn’t clear yay and paru are similar tools that serve the same purpose.