最新消息:20190529 VPS服务器已从腾讯云香港换为Vultr新加坡,主题仍用朋友推荐的大前端D8

[未解决]恢复git stash pop之前的状态

Git crifan 1684浏览 0评论

git stash pop revert

Undo Git Stash Pop – Stack Overflow

Undoing accidental git stash pop – Stack Overflow

How to recover a dropped stash in Git? – Stack Overflow

Undo git stash pop that results in merge conflict – Stack Overflow

之前有:

licrifandeMacBook-Pro:iOS-Client crifan$ git stash pop
Auto-merging JianDao/MyViewController.swift
CONFLICT (content): Merge conflict in JianDao/MyViewController.swift
licrifandeMacBook-Pro:iOS-Client crifan$ git stash
JianDao/MyViewController.swift: needs merge
JianDao/MyViewController.swift: needs merge
JianDao/MyViewController.swift: unmerged (b810e289979d1441ef86cec76f7cf5824bdbf2c8)
JianDao/MyViewController.swift: unmerged (bba0e193d34a6b8693e41a3d722c76646e7798e0)
JianDao/MyViewController.swift: unmerged (208eff046bbef7dfaac7ceaeff57438c80ac3b1b)
fatal: git-write-tree: error building trees
Cannot save the current index state
licrifandeMacBook-Pro:iOS-Client crifan$ git pull
error: Pull is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use ‘git add/rm <file>’
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
licrifandeMacBook-Pro:iOS-Client crifan$ git stash pop
JianDao/MyViewController.swift: needs merge
unable to refresh index
licrifandeMacBook-Pro:iOS-Client crifan$ git status
On branch master
Your branch is up-to-date with ‘origin/master’.
Changes to be committed:
  (use "git reset HEAD <file>…" to unstage)
    modified:   JianDao/ContactUtility.swift
    modified:   JianDao/JianDao.xcodeproj/project.pbxproj
    modified:   JianDao/JianDao/Constants.swift
    modified:   JianDao/JianDao/Info.plist
Unmerged paths:
  (use "git reset HEAD <file>…" to unstage)
  (use "git add <file>…" to mark resolution)
    both modified:   JianDao/MyViewController.swift
Changes not staged for commit:
  (use "git add <file>…" to update what will be committed)
  (use "git checkout — <file>…" to discard changes in working directory)
    modified:   JianDao/JianDao/Constants.swift
licrifandeMacBook-Pro:iOS-Client crifan$ git add JianDao/MyViewController.swift
licrifandeMacBook-Pro:iOS-Client crifan$ git stash pop
Auto-merging JianDao/MyViewController.swift
CONFLICT (content): Merge conflict in JianDao/MyViewController.swift
licrifandeMacBook-Pro:iOS-Client crifan$ git status
On branch master
Your branch is up-to-date with ‘origin/master’.
Changes to be committed:
  (use "git reset HEAD <file>…" to unstage)
    modified:   JianDao/ContactUtility.swift
    modified:   JianDao/JianDao.xcodeproj/project.pbxproj
    modified:   JianDao/JianDao/Constants.swift
    modified:   JianDao/JianDao/Info.plist
Unmerged paths:
  (use "git reset HEAD <file>…" to unstage)
  (use "git add <file>…" to mark resolution)
    both modified:   JianDao/MyViewController.swift
Changes not staged for commit:
  (use "git add <file>…" to update what will be committed)
  (use "git checkout — <file>…" to discard changes in working directory)
    modified:   JianDao/JianDao/Constants.swift
licrifandeMacBook-Pro:iOS-Client crifan$ git stash list
stash@{0}: WIP on master: f19dc99 change send and receive picture style
licrifandeMacBook-Pro:iOS-Client crifan$ 

去试试:

licrifandeMacBook-Pro:iOS-Client crifan$ git stash apply 208eff046bbef7dfaac7ceaeff57438c80ac3b1b
error: object 208eff046bbef7dfaac7ceaeff57438c80ac3b1b is a blob, not a commit
error: object 208eff046bbef7dfaac7ceaeff57438c80ac3b1b is a blob, not a commit
‘208eff046bbef7dfaac7ceaeff57438c80ac3b1b’ is not a stash-like commit
licrifandeMacBook-Pro:iOS-Client crifan$
licrifandeMacBook-Pro:iOS-Client crifan$ git stash drop
Dropped refs/stash@{0} (c7c73883e23f4cc73d0afc3da8bb665728bd3f37)
licrifandeMacBook-Pro:iOS-Client crifan$
licrifandeMacBook-Pro:iOS-Client crifan$ git stash drop
Dropped refs/stash@{0} (c7c73883e23f4cc73d0afc3da8bb665728bd3f37)
licrifandeMacBook-Pro:iOS-Client crifan$ git branch tmp c7c73883e23f4cc73d0afc3da8bb665728bd3f37
licrifandeMacBook-Pro:iOS-Client crifan$ git stash apply tmp
JianDao/MyViewController.swift: needs merge
unable to refresh index
licrifandeMacBook-Pro:iOS-Client crifan$ git stash
JianDao/MyViewController.swift: needs merge
JianDao/MyViewController.swift: needs merge
JianDao/MyViewController.swift: unmerged (b810e289979d1441ef86cec76f7cf5824bdbf2c8)
JianDao/MyViewController.swift: unmerged (a361986dd8a39395c12c0106aafb3a2afd83fa5f)
JianDao/MyViewController.swift: unmerged (208eff046bbef7dfaac7ceaeff57438c80ac3b1b)
fatal: git-write-tree: error building trees
Cannot save the current index state
licrifandeMacBook-Pro:iOS-Client crifan$

最终还是没有恢复我刚才已经修改好的文件:

算了,单个文件,重新再修改一遍吧。。。

改好后,至少没有错误了:

转载请注明:在路上 » [未解决]恢复git stash pop之前的状态

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
63 queries in 0.100 seconds, using 18.80MB memory