What is the meaning of revert this commit and roll back this commit in GitHub for Windows?

依然范特西╮ 提交于 2019-12-02 17:51:59
JB Nizet

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.

VonC

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?

It is now (March 2013), with GitHub for Windows, you can undo a rollback without having to type any git command:

See "Undo Button in GitHub for Windows"

we've added Undo support for Discards, Commits, Rollbacks, and Merges:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!