2014-01-30 26 views
0

所以,我檢查了一個分支,做了一些工作,藏匿的變化,並檢查出的主:意外的混帳藏匿,現在不能彈出 - 如何撤消?

$ git checkout my-branch 
    ... make changes 
    $ git stash 
    $ git checkout master 

於是,我意外地應用於我的藏匿掌握,它不應該去,並得到了很多衝突消息:

$ git stash apply 
    Auto-merging app/common/collections/visitors-realtime.js 
    CONFLICT (content): Merge conflict in app/common/collections/visitors-realtime.js 
    ... 

糟糕!現在我想撤消這個。試圖彈出藏匿不起作用:

$ git stash pop 
    app/support/backdrop_stub/responses/licensing_realtime.json: needs merge 
    styles/common/visitors_realtime.scss: needs merge 
    unable to refresh index ... 

我不能只是看看其他的分支:

$ git checkout my-branch 
app/support/backdrop_stub/responses/licensing_realtime.json: needs merge 
styles/common/visitors_realtime.scss: needs merge 
error: you need to resolve your current index first 

我想不應用這些變化掌握,回去我的分支,並在那裏應用它們。我怎樣才能做到這一點?

+0

只是重置回提交您的應用前藏匿? git reset --hard Tim

回答

1

如果您已應用藏匿你應該仍然在你的藏匿的改變,git stash list

在你可以做git reset --hard並轉到您的分行,並做這種情況下git stash applygit stash pop

popapply之間的區別在於apply的變化將繼續留在你的藏匿,而與pop它會從你的藏匿名單中刪除

1

你必須先清理工作副本 - 又名重置到最後COMMITED狀態:

git reset --hard 

然後籤的最新承諾,並重新申請藏匿