Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

5,817 views 4 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you