In a Git tutorial I'm going through, git commit
is used to store the changes you've made.
What is git push
used for then?
Commit - committing is the process which records changes in the repository. Think of it as a snapshot of the current status of the project. Commits are done locally. Push - pushing sends the recent commit history from your local repository up to GitHub.
The git push command allows you to send (or push) the commits from your local branch in your local Git repository to the remote repository. To be able to push to your remote repository, you must ensure that all your changes to the local repository are committed.
Commit saves the changes you made only to the local repository but not to the remote repository. Your commits are not automatically synchronized to the remote repository – you have to explicitly push the commits you want to share. When you use the push command, you apply your changes to the upstream repository.
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 GitReady.com (the article I referred to first)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With