What are the differences between "git commit" and "git push"?
Well, basically Git commit puts your changes into your local repository, while git push sends your changes to the remote location.
Basically, git commit
"records changes to the repository" while git push
"updates remote refs along with associated objects". So the first one is used in connection with your local repository, while the latter one is used to interact with a remote repository.
Here is a nice picture from Oliver Steele, that explains the Git model and the commands:
Read more about git push
and git pull
on Pushing and pulling (the article I referred to first).
commit: adding changes to the local repository
push: to transfer the last commit(s) to a remote server
git push
is used to add commits you have done on the local repository to a remote one. Together with git pull
, it allows people to collaborate.