2016-04-07 79 views
0

我想知道哪个分支隐藏了我最近5个小时的工作。 我错误地输入了藏匿地点,我的所有变化都消失了!如何恢复未在git中提交的隐藏文件?

偶然我输入:

git stash 

这是我所看到的enter image description here

然后我检查了我的分支:

然后我试图带回我的藏匿。我结帐我的分支类型

git stash pop 

现在我得到这样的:

(use "git reset HEAD <file>..." to unstage) 

    new file: ******************/UIViewController+Keyboard.h 
    new file: ******************/UIViewController+Keyboard.m 

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: ******************.xcodeproj/project.pbxproj 
    modified: ******************/CTAuthenticateUserViewController.m 

Untracked files: 
    (use "git add <file>..." to include in what will be committed) 

    ******************/Base.lproj/Bernard copy.storyboard 
    ******************/Base.lproj/Bernard.storyboard 
    ******************/Keyboard.h 

这是我的猜测是正确的:

(use "git reset HEAD <file>..." to unstage) 

这意味着通过删除我的所有藏匿文件升级它们!

use "git add <file>..." 

这将替换当前文件与存储文件?!

"git checkout -- <file>... 

藏匿的变化去bin和最后提交成为头

"git add <file>..." 

这将这些文件添加到当前分支,它来源于藏匿

回答

1

git stash pop适用您的藏匿更改当前检出工作树。 如果该命令没有提供任何错误(如“冲突发生”或类似错误),git能够应用更改并从存储堆栈中删除存储提交。 stash applystash pop完成后,它会执行git status,以便您看到工作树的当前状态。 存储还会保留添加到索引中的内容以及您刚添加到索引中的内容。 因此,您现在应该已经完成​​所有工作,并可以继续进行。

+0

是的你是对的。我想知道那些提示git status意味着什么。 – Bernard

+0

顺便说一句,我刚刚意识到所有消失的文件都回来了 – Bernard

+0

好吧,它与存储无关,它只是正常的'git状态'输出,暗示你可以在特定文件上使用哪些命令来实现一些典型目标。 – Vampire