Reputation: 2909
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.
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?
Upvotes: 187
Views: 118011
Reputation: 2017
To add to camiblanch'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:"
Upvotes: 92
Reputation: 1322
Check this out; it will be helpful for understanding push, pull, commit and sync.
- Commit - committing is the process which records changes in the repository. Think of it as a snapshot of the current status of the project. Commits are done locally.
- Push - pushing sends the recent commit history from your local repository up to GitHub. If you're the only one working on a repository, pushing is fairly simple. If there are others accessing the repository, you may need to pull before you can push.
- Pull - a pull grabs any changes from the GitHub repository and merges them into your local repository.
- Sync - syncing is like pulling, but instead of connecting to your GitHub copy of the forked repo, it goes back to the original repository and brings in any changes. Once you've synced your repository, you need to push those changes back to your GitHub account.
Upvotes: 4
Reputation: 51
In GitHub, the "commit" action saves your changes to the local repository, while the "push" action sends those changes to a remote repository. "Commit and push" combines these two actions into one, allowing you to save your changes locally and then push them to a remote repository with a single command.
"Commit and sync" is a similar concept, but it also pulls down any changes from the remote repository that have been made since your last commit. This allows you to keep your local repository up to date with the latest changes from other contributors.
Finally, "commit and create pull request" combines the commit and push actions with the creation of a new pull request. This allows you to propose your changes for review by other contributors to the project, and start a discussion about the changes you've made.
In summary, the differences between these options are:
"Commit": saves your changes to the local repository "Commit and push": saves your changes to the local repository and pushes them to the remote repository "Commit and sync": saves your changes to the local repository, pulls down any new changes from the remote repository, and merges them with your local repository "Commit and create pull request": saves your changes to the local repository, pushes them to the remote repository, and creates a new pull request for review.
Upvotes: 5
Reputation: 4072
See more from Microsoft here
Upvotes: 291