私は初めてgit stash save
を試しました。それは正常に働いた。それから私はgit stash apply
を試しましたが、私のコミットされていない変更が復元されていた間に、私の作業コピーのルートからのランダムなディレクトリが削除されました。なぜ私はそれが正確なdirを選んだのかわからない、そこにルートのような他のdirsがたくさんある。`git stash apply`は私の作業コピーからランダムなディレクトリを削除しました
git stash save
出力:
Saved working directory and index state WIP on clipping: cfeac4b - applying the solution from http://stackoverflow.com/questions/40385482/why-cant-i-use-opengl-es-3-0-in-qt
HEAD is now at cfeac4b - applying the solution from http://stackoverflow.com/questions/40385482/why-cant-i-use-opengl-es-3-0-in-qt
短縮git stash apply
出力:
Removing debug_stencil_not_working/textureandlight.js
Removing debug_stencil_not_working/qtlogo.png
[... more removes here ...]
On branch clipping
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: documentation/textureSize_missing.txt
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: ../debug_stencil_not_working/qtlogo.png
deleted: ../debug_stencil_not_working/textureandlight.js
[... more deleted files here ...]
modified: main.cpp
modified: main.qml
[... more modified files here ...]
Untracked files:
(use "git add <file>..." to include in what will be committed)
../dbg_repeater/dbg_repeater.pro.user
debug_stencil_not_working/
[... more files and dirs here ...]
注:削除された dirがコミットしてプッシュDIRました。コミットされていないローカル変更はありませんでした。
このランダムなディレクトリが削除された理由は何ですか?
また、このディレクトリを復元するにはどうすればよいですか。 github Webインターフェイスのルートを参照すると、そこにあります。しかし、私はgit pull origin clipping
を試して、それは私の作業コピーにそのディレクトリを引き戻さなかった。
編集:私はそれを復元する方法を考え出しました。 TortoiseGitのコンテキストメニューで「Diff」を選択し、リストの中に削除されたファイルが「見つからない」と表示されました。私はそれらをすべて選択し、右クリックして「元に戻す」を選択しました。まだ最初の場所が削除された理由は分かりません。
'apply'(' drop'ではなく)を使用した場合、stashはまだ残っているはずです。そのため、 'git stash show'で調べることができます。これは実際には、インデックスコミットではなく、作業ツリーコミットのみを示しているので、別のステージングとダーティーな作業ツリーを実行した場合、別のステップが必要になる可能性があります。 – torek
@torek:おかげさまで、 'git stash show'の出力ではどうしたらいいですか? –
Dファイルがあるかどうか確認してください。何も表示されない場合は、stashペア( 'stash^1')の基底とインデックスコミット(' stash')を比較する 'git diff --name-status stash^1 stash'を試し、 *それらの*は 'D 'として表示されます。 – torek