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?
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?
A very crude analogy: if we compare
git commit
to saving an edited file, thengit push
would be copying that file to another location.Please don't take this analogy out of this context -- committing and pushing are nothing like saving an edited file and copying it. That said, it should hold for comparisons sake only.
commit: adding changes to the local repository
push: to transfer the last commit(s) to a remote server
Commit: {Snapshot | Changeset | History record | Version | 'Save-as'} of a repository. Git repository = series (tree) of commits (plus few extra things).
Local repository: repository on your machine.
Remote repository: repository on a server (eg Github).
git commit
: Add a new commit (last commit + staged modifications) to the local repository.git push
,git pull
: Sync the local repository with a remote repository.push
- apply changes from local into remote,pull
- apply changes from remote into local.