git Commit、Commit 和 Push、Commit 和 Sync 之间的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30038999/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:10:36  来源:igfitidea点击:

Differences between Commit, Commit and Push, Commit and Sync

gitvisual-studiogithubgit-commit

提问by Alfred Waligo

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.

我正在使用 Visual Studio 2013,当我提交 C# 代码时,我面临着 3 个选项。我需要解释每个选项之间关于我的本地存储库与 GitHub 存储库发生的情况的差异。

  • Option 1 says Commit
  • Option 2 says Commit and Push
  • Option 3 says Commit and Sync
  • 选项 1 表示提交
  • 选项 2 表示提交和推送
  • 选项 3 表示提交和同步

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?

我不太明白最后两个选项之间的区别。什么时候应该使用提交和同步而不是提交和推送?

回答by camiblanch

  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.
  1. Commit 只会记录您在本地机器上所做的更改。它不会标记远程存储库中的更改。
  2. Commit 和 Push 将执行上述操作并将其推送到远程存储库。这意味着您所做的任何更改也将保存到远程存储库。
  3. 提交和同步做了三件事。首先,它会提交。其次,它将执行拉取(从远程仓库中获取更新的信息)。最后,它会推动。

See more from Microsoft here

在此处查看来自 Microsoft 的更多信息

回答by A.sharif

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

添加到camieblanch的答案。我从 tanascius (这里)找到了这张有用的图片/帖子。“这是 Oliver Steele 的一张很好的图片,它解释了 git 模型和命令:” 在此处输入图片说明

回答by hmlasnk

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

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