Differences between Commit, Commit and Push, Commit and Sync

77,743

Solution 1

  1. Commit will simply make record of your changes that you have made on your local machine. It will not mark the change in the remote repository.
  2. Commit and Push will do the above and push it to the remote repository. This means that any changes you have made will be saved to the remote repository as well.
  3. Commit and Sync does three things. First, it will commit. Second, it will perform a pull (grabs the updated information from the remote repo). Finally, it will push.

See more from Microsoft here

Solution 2

To add to camieblanch's answer. I found this helpful picture/post from tanascius (here). "Here is a nice picture from Oliver Steele, that explains the git model and the commands:" enter image description here

Solution 3

Checkout on this. It will be helpfull for understand push, pull, commit and sync.

https://learn.sparkfun.com/tutorials/using-github-to-share-with-sparkfun/committing-pushing-and-pulling

Share:
77,743

Related videos on Youtube

Alfred Waligo
Author by

Alfred Waligo

Updated on January 14, 2020

Comments

  • Alfred Waligo
    Alfred Waligo over 4 years

    I'm using visual studio 2013, and I'm faced with 3 options for when I commit my C# code. I need an explanation of the differences between each of the options with regards to what happens to my local repo vs. the GitHub repo.

    • Option 1 says Commit
    • Option 2 says Commit and Push
    • Option 3 says Commit and Sync

    I don't quite understand the difference between the last 2 options. When should I use Commit and Sync as opposed to Commit and Push?

  • Bhuwan Pandey
    Bhuwan Pandey almost 8 years
    I really don't get the "Commit and Sync" First, it will commit. Second, it will perform a pull Finally, it will push. Why push required here when code changes are already committed to the remote repository(No changes to push).
  • camiblanch
    camiblanch almost 8 years
    @BhuwanPandey Performing a "commit" doesn't include a "push". They are separate. Only a "push" will update your commit to the remote repository. See the image in the other answer to see that. The "commit" goes from index to local repository, while "push" finishes by going from the local repository to the remote repository
  • Murali Dhar Darshan
    Murali Dhar Darshan about 5 years
    Can Sync operation cause conflicts when multiple users working simultaneously into the application?
  • Fabiano
    Fabiano almost 5 years
    I am using Visual Studio 2017, and the Commit and Sync command does not completely push your changes. I'm saying that because by performing a Sync my changes are shown in the history tab in Visual Studio, but at Github site it doesn`t appear. I had to perform a Push command after Commig and Sync, and then my changes appeared in Github site.
  • Alan Baljeu
    Alan Baljeu over 4 years
    I think confusion comes from thinking Commit sends files to the remote repository. In fact Commit merely records your edits with the local repository. Without Push it never hits the server.
  • Alan Baljeu
    Alan Baljeu over 4 years
    But where is Sync in this picture?
  • A.sharif
    A.sharif over 4 years
    It doesn't exist in the picture. If you refer back to "camiblanch"'s answer. It's commit to your local repo, pull to sync(merge) the remote repo with your local repo and then it pushes the merged local repo to the remote repo.
  • Robbie Dee
    Robbie Dee over 3 years
    @Fabiano Agreed. If I do Commit and then Sync, I am prompted to push to commit to the remote server. This would seem to be at odds with the answer here.