Git消除了我的变化,我可以让他们回来 [英] Git erased my changes, can I get them back

查看:96
本文介绍了Git消除了我的变化,我可以让他们回来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在分支上做了一些改动,我们称之为branch2。我切换到主分支而不提交更改。我猜这是一个禁忌,因为当我切换回分支2时,我所有的改变都消失了!如果用于mac的GitHub客户端会警告我,那肯定会很好。是否有反正我可以撤销这个动作并且得到我的变化?

I had some changes in a branch, we'll call it branch2. I switched to the master branch without committing the changes. I'm guessing this is a no-no because when I switched back to branch2 all of my change were gone! It sure would have been nice if the GitHub client for mac would have warned me. Is there anyway I can undo this action and get my changes back?

推荐答案

如果没有提交,那么没有任何做。虽然,这很奇怪,因为如果你的工作目录中有未提交的数据,git将不允许你切换分支(我不知道github是否适合mac)。

If it wasn't committed, then there's nothing to do. Although, this is weird because normally git won't allow you to switch branch if you have uncommitted data in your working directory (I don't know for github for mac exactly).

您总是可以检查 git reflog 以查看您是否提交了您的数据。

You can always check git reflog to see if you have committed your data.

这篇关于Git消除了我的变化,我可以让他们回来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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