在GitHub for Windows中恢复此提交并回滚此提交的含义是什么? [英] What is the meaning of revert this commit and roll back this commit in GitHub for Windows?

查看:142
本文介绍了在GitHub for Windows中恢复此提交并回滚此提交的含义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Github for Windows具有以下两个命令:


  1. 恢复此提交 - 创建一个新的提交来恢复此提交的更改

  2. 回滚此提交 - 回滚此提交,这个和以后提交到你的工作目录中

你能解释这两个命令的确切含义以及它们如何使用。具体而言,我不明白第二个目标是什么。这对我来说没有意义。



是否有可能恢复到以前的提交检查出来,如果我不喜欢它,请返回到最初的位置?



这个GUI似乎只包含了git系统的一小部分,但是它是一个合适的工作流程吗?

解决方案

假设您的仓库中有单个文件,并且您有以下提交:

  commit 1:该文件包含A 
commit 2:该文件包含B
commit 3:该文件包含C

如果您在 commit 3 执行回复,您将在回购中拥有这个功能:

 提交1:文件包含A 
提交2:文件包含B
提交3:文件包含C
提交4:该文件包含B

并且工作副本中的文件也将包含B。 / p>

如果您执行回退,您将在重新执行此操作po:

 提交1:文件包含A 
提交2:文件包含B
code>

并且工作副本中的文件将保持不变。因此,该文件将包含C.它允许您修复一个小错误并再次提交,例如。


Github for Windows features these two commands described as:

  1. revert this commit - create a new commit that reverts the changes of this commit
  2. rollback this commit - roll back this commit leaving all changes made in this and later commits in your working directory

Could you explain the exact meaning of these two commands and how they can be used. Specifically I fail to understand what is the purpose of the second one. It makes no sense to me.

Is it possible to revert to a previous commit check it out and if I don't like it, go back to where it was initially?

This gui seems to feature a very small part of the git system but what would be a proper workflow utilizing it?

解决方案

Suppose you have a single file in your repo, and you have the following commits:

commit 1 : the file contains A
commit 2 : the file contains B
commit 3 : the file contains C

If you execute revert on commit 3, you'll have this in the repo:

commit 1 : the file contains A
commit 2 : the file contains B
commit 3 : the file contains C
commit 4 : the file contains B

And the file in your working copy will contain B as well.

If you execute roll back, you'll have this in the repo:

commit 1 : the file contains A
commit 2 : the file contains B

And the file in your working copy will be left unmodified. The file will thus contain C. It allows you to fix a small mistake and commit again, for example.

这篇关于在GitHub for Windows中恢复此提交并回滚此提交的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆