到達不能なコミットが多数あります(入力clear
中にコンソールを試してみましgit stash
た)
git fsckを少しいじって、これらのハッシュをたくさん持っています
xargs
これらのハッシュをgitstashに戻す簡単な方法はありますか?
速い答え:
git fsck | grep commit | cut -d' ' -f3 |
while read hash; do git rev-parse --verify --quiet $hash^2 && echo $hash; done |
xargs git log --grep WIP --pretty=oneline |
while read hash wip on branch commit junk; do
git checkout $hash; git reset --soft $commit; git stash; done
これにより、スタッシュのインデックス部分と作業ツリー部分が異なるスタッシュに分離されることに注意してください。保存した出力の例を教えてください。隠し場所には複数のパーツがあり、すべてのパーツのSHAがない場合があります。
正しい相対ベースからスタッシュを再現するためのサンプルスタッシュ検出スクリプトを含めるように編集されました。