在GitHub桌面(或Github for Windows)中回滚无限制的更改 [英] Rollback uncommited changes in GitHub Desktop (or Github for Windows)

查看:138
本文介绍了在GitHub桌面(或Github for Windows)中回滚无限制的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了Stack Overflow上的许多帖子以及网络上的许多页面(包括GitHub的帮助页面),并花了我数小时才弄清楚如何做这个超级简单的事情,这根本不明显。我会在这里回答我自己的问题。



我使用



Github桌面文档现在包含有关如何to 放弃更改。然而,这是不正确的!当您右键单击单个文件时,弹出窗口不会 提供屏蔽所有更改...选项,因为它们的屏幕快照似乎表明。放弃所有需要按照上述描述进行的更改。


I read dozens of posts on Stack Overflow as well as many pages on the web (including GitHub's help pages) and it took me hours to figure out how to do this super simple thing, which is frankly not obvious at all, so I'm going to answer my own question here.

I'm using GitHub for Windows (update: it's now called Github Desktop) and I made a bunch of changes to my local files. It became such a mess that I decided I just want to rollback my local files to where they were the last time I made a commit. I haven't committed the new changes - I just want to get rid of them. How can I do this?

解决方案

In keeping up with the times, Github for Windows has had a huge makeover, so here's a new answer. It's now called Github Desktop and the version numbers have started back at v1.0.0. So if you're running Github Desktop v1 then your UI is going to look a little different.

This super-handy, always-hidden little feature, however, is still there.

First, select your repository in the far-left dropdown in the black area. Make sure you then select the tab that says "Changes". Now you can right-click anywhere in the rectangle that contains "{#} changed files" and you'll get a pop-up that says "Discard all changes..." Click that and, presto, you're back to where you were the last time you made a commit.

Bonus: You can also right-click any of the changed files to get a pop-up that will enable you to "Discard changes..." for only that file. Click that and only that file will revert back to where it was at the last commit.

The Github Desktop documentation now includes information on how to discard changes. It is, however, incorrect! When you right-click an individual file the pop-up does not give the option to "Discard all changes..." as their screen shot seems to indicate. To discard all changes you need to do as I describe above.

这篇关于在GitHub桌面(或Github for Windows)中回滚无限制的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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