xx0219
V2EX  ›  问与答

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

  •  
  •   xx0219 · Nov 1, 2016 · 4906 views
    This topic created in 3557 days ago, the information mentioned may be changed or developed.

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

    6 replies    2016-11-01 18:13:50 +08:00
    xx0219
        1
    xx0219  
    OP
       Nov 1, 2016
    用 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  
       Nov 1, 2016
    你没有 commit 就直接 pull 了吗?这样的话,客户端难道不会提醒你吗?

    如果 commit 了,那还有救,没有 commit 的话好像没救了——但客户端可能帮你自动 stash 了也说不定(我瞎猜的)。
    airycanon
        3
    airycanon  
       Nov 1, 2016
    只知道用 Jetbrains 家的 IDE 还有救,有本地历史记录,看看其他大神怎么说。
    ghos
        4
    ghos  
       Nov 1, 2016
    还是 Jetbrains IDE 好 自动 stash unstash !
    9hills
        5
    9hills  
       Nov 1, 2016   ❤️ 1
    如果文件没有加入暂存区, git 没救。有些 IDE/Editor 有历史功能,比如 vim 可以设置 backup ,救了我很多次
    如果文件加入了暂存区但是没有 commit ,那么用 git fsck 找 object 出来
    如果是 commit 后丢了, git reflog 可以找到丢失的 commit
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5838 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 02:12 · PVG 10:12 · LAX 19:12 · JFK 22:12
    ♥ Do have faith in what you're doing.