Difference Between Commit and Push in Git

Since Git is a distributed version of source control, that means there is the repository on your local system, along with however many clones of that repository on GitHub and coworker’s computers. By committing files, that means you are making these changes to your local version of Git. If you are coming from a Subversion(SVN) environment, then committing changes still means the same thing. But, since Git is distributed, not centralized like SVN, the changes are made to your local copy. This can make the commit process function much more quickly and efficiently as there is no centralized server to deal with.

Often, there is a repository that works centrally to allow multiple developers to maintain one code base, like GitHub. It is centralized in the sense that everybody is feeding and feeding off of one repository, but if that repository goes down, everybody else can function independently. To “push” the changes to another repository that you “commited” to your own local repository, you must utilize the git push command.

Summing Up:

  • Doing a commit updates your local repository
  • Doing a push updates any changes to a remote repository