Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

For newbies, What do Git Pull, Push, and Commit do?

For those not familiar with Git commands, the following web page may be very useful. It includes a discussion of:
The major difference between Git and any other VCS (version control system) .
Here are some highlights from the above page:

"Now, pay attention. This is the main thing to remember about Git if you want the rest of your learning process to go smoothly. Git has three main states that your files can reside in: committed, modified, and staged. Committed means that the data is safely stored in your local staged. Committed means that the data is safely stored in your local database (repository). Modified means that you have changed the file but have not committed it to your database yet. Staged means that you have marked a modified file in its current version to go into your next commit snapshot."

This means that Commit does not modify the remote repository by itself, only when you do a Push at the same time or at a later time as a Commit.
If you thought that Commit makes your changes visible to other users of the remote repository, that is wrong.  Push is what accomplishes that.  Pull is what merges other users' changes into the files you have modified (but not pushed) and what copies the changes others have made to files you have not modified.

The following web page explains more about what commit really does.

The above web page is part of a useful chapter that is introduced here:

The following web page explains what push and pull really do.

I found that when someone had updated the remote repository and I had modified files in my local repository, it helped if I used Sourcetree to first do a commit without a push, then a simple pull (using the defaults or checking 'Commit merged changes immediately).  Then I could do a commit if necessary, and then a Push.  Every other sequence I tried in Sourcetree gave me an error.



Log in or Sign up to comment

Atlassian Community Events