【发布时间】:2014-12-16 21:54:10
【问题描述】:
我试图回滚到之前的提交,但显然我搞砸了。 所以我需要恢复。
幸运的是我藏了起来;但应用后出现以下错误:
error: Your local changes to the following files would be overwritten by merge:
Bliss.storyboard
Bliss2.xcodeproj/project.pbxproj
Bliss2/(3.0)DiscoveryViewController.swift
Bliss2/(3.6)Contribute.swift
Bliss2/(3.7)CameraContribute.swift
Bliss2/Environment.swift
Please, commit your changes or stash them before you can merge.
Aborting
所以我又藏起来了。这是我的藏匿处:
$~/workarea/bliss/Bliss2:git stash list
stash@{0}: WIP on RicBranch: e3cb317 Revert "Linked up BlissThoughts & hidden toggle for (3.6) TextView" Temp go back and see old
stash@{1}: WIP on RicBranch: 40e664a Creation of (3.10) DiscoveryUploadViewController.
所以我尝试了这个并得到了同样的错误:
$~/workarea/bliss/Bliss2:git stash apply #1
error: Your local changes to the following files would be overwritten by merge:
Bliss.storyboard
Bliss2.xcodeproj/project.pbxproj
Bliss2/(3.0)DiscoveryViewController.swift
Bliss2/(3.6)Contribute.swift
Bliss2/(3.7)CameraContribute.swift
Bliss2/Environment.swift
Please, commit your changes or stash them before you can merge.
Aborting
$~/workarea/bliss/Bliss2:git commit -m 'Committed garbage'
On branch RicBranch
Changes not staged for commit:
deleted: ../(3.6)TableViewCell.xib
modified: ../Bliss.storyboard
modified: ../Bliss2.xcodeproj/project.pbxproj
modified: (3.0)DiscoveryViewController.swift
modified: (3.6)Contribute.swift
modified: (3.7)CameraContribute.swift
modified: Environment.swift
no changes added to commit
$~/workarea/bliss/Bliss2:git stash apply #1
error: Your local changes to the following files would be overwritten by merge:
Bliss.storyboard
Bliss2.xcodeproj/project.pbxproj
Bliss2/(3.0)DiscoveryViewController.swift
Bliss2/(3.6)Contribute.swift
Bliss2/(3.7)CameraContribute.swift
Bliss2/Environment.swift
Please, commit your changes or stash them before you can merge.
Aborting
$~/workarea/bliss/Bliss2:
这是我所在位置的快照。我想回滚到“RicBranch”:
我正在尝试回滚到“干净”提交:(3.10) 提交。
但是 Git 一直说我必须再做一次提交/存储。
我想做的就是在所有这些混乱发生之前回滚到我以前的 HEAD。
如何弹出原始 HEAD 或应用 2nd Stash(版本 3.10)?
【问题讨论】:
-
首先 - 你的
git status显示了什么?另外,您是要返回到特定的存储条目,还是在另一个分支上提交? -
此链接可能会有所帮助:stackoverflow.com/questions/15164300,因为它看起来非常相关。
-
git reset --hard <commit sha1>会将您返回到特定的提交,除非您已经推送了更改。 (它也会这样做,但是远程端的事情会变得复杂,尤其是如果其他人也使用你的存储库)
标签: git