V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
xx0219
V2EX  ›  问与答

Github .. 没提交就不小心点同步了... 导致本地文件被远程的覆盖了... 有解么??????????

  •  
  •   xx0219 · 2016-11-01 13:58:16 +08:00 · 4383 次点击
    这是一个创建于 2752 天前的主题,其中的信息可能已经有所发展或是发生改变。

    ...... 脑子一昏 诶诶..... 用的 mac github desktop 官方的 gui 工具....

    6 条回复    2016-11-01 18:13:50 +08:00
    xx0219
        1
    xx0219  
    OP
       2016-11-01 14:15:33 +08:00
    用 git reflog 出来 下面两条.... 然后用 git reset --hard 8413f55 git reset --hard 91d4794 出来的都不是自己想要的 ...
    自己被删掉的数据 是 head0 之后的 自己新增的数据 但是没有 commit 上去的... reset 无效...

    8413f55 HEAD@{0}: commit: Update Themes
    91d4794 HEAD@{1}: clone: from https://github.com/Xu-Jian/Xu-Jian.github.io.git
    oott123
        2
    oott123  
       2016-11-01 17:15:40 +08:00
    你没有 commit 就直接 pull 了吗?这样的话,客户端难道不会提醒你吗?

    如果 commit 了,那还有救,没有 commit 的话好像没救了——但客户端可能帮你自动 stash 了也说不定(我瞎猜的)。
    airycanon
        3
    airycanon  
       2016-11-01 17:40:20 +08:00
    只知道用 Jetbrains 家的 IDE 还有救,有本地历史记录,看看其他大神怎么说。
    ghos
        4
    ghos  
       2016-11-01 18:09:46 +08:00
    还是 Jetbrains IDE 好 自动 stash unstash !
    9hills
        5
    9hills  
       2016-11-01 18:12:10 +08:00   ❤️ 1
    如果文件没有加入暂存区, git 没救。有些 IDE/Editor 有历史功能,比如 vim 可以设置 backup ,救了我很多次
    如果文件加入了暂存区但是没有 commit ,那么用 git fsck 找 object 出来
    如果是 commit 后丢了, git reflog 可以找到丢失的 commit
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5537 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 05:43 · PVG 13:43 · LAX 22:43 · JFK 01:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.