Note: Je viens réécrite cette réponse avec 24 heures plus git-fu sous ma ceinture :) Dans mon histoire shell, tout le tralala est maintenant trois one-liners. Cependant, je les ai décondensés pour votre commodité. De cette façon, j'espère que vous serez capable de voir comment j'ai fait les choses, au lieu de simplement copier/coller aveuglément des choses.
Voici étape par étape.
Supposons que la source soit dans ~/OLDREPO contenant des stashes. Créer un clone TEST ne contenant pas stashes:
cd ~/OLDREPO
git clone . /tmp/TEST
pousser tous les stashes que des branches temporaires:
git send-pack /tmp/TEST $(for sha in $(git rev-list -g stash); \
do echo $sha:refs/heads/stash_$sha; done)
boucle sur l'extrémité de réception pour transformer de nouveau en stashes:
cd /tmp/TEST/
for a in $(git rev-list --no-walk --glob='refs/heads/stash_*');
do
git checkout $a &&
git reset HEAD^ &&
git stash save "$(git log --format='%s' -1 [email protected]{1})"
done
Nettoyage de votre branches temporaires si vous voulez
git branch -D $(git branch|cut -c3-|grep ^stash_)
Faites une liste de git stash et vous quelque chose comme ceci:
[email protected]{0}: On (no branch): On testing: openmp import
[email protected]{1}: On (no branch): On testing: zfsrc
[email protected]{2}: On (no branch): WIP on sehe: 7006283 fixed wrong path to binary in debianized init script (reported as part of issue
[email protected]{3}: On (no branch): WIP on debian-collab: c5c8037 zfs_pool_alert should be installed by default
[email protected]{4}: On (no branch): WIP on xattrs: 3972694 removed braindead leftover -O0 flag
[email protected]{5}: On (no branch): WIP on testing: 3972694 removed braindead leftover -O0 flag
[email protected]{6}: On (no branch): WIP on testing: db9f77e fuse_unmount_all could be starved for the mtx lock
[email protected]{7}: On (no branch): WIP on xattrs: db9f77e fuse_unmount_all could be starved for the mtx lock
[email protected]{8}: On (no branch): WIP on testing: 28716d4 fixed implicit declaration of stat64
[email protected]{9}: On (no branch): WIP on emmanuel: bee6660 avoid unrelated changes
Sur le référentiel d'origine, le même ressemblait
[email protected]{0}: WIP on emmanuel: bee6660 avoid unrelated changes
[email protected]{1}: WIP on testing: 28716d4 fixed implicit declaration of stat64
[email protected]{2}: WIP on xattrs: db9f77e fuse_unmount_all could be starved for the mtx lock
[email protected]{3}: WIP on testing: db9f77e fuse_unmount_all could be starved for the mtx lock
[email protected]{4}: WIP on testing: 3972694 removed braindead leftover -O0 flag
[email protected]{5}: WIP on xattrs: 3972694 removed braindead leftover -O0 flag
[email protected]{6}: WIP on debian-collab: c5c8037 zfs_pool_alert should be installed by default
[email protected]{7}: WIP on sehe: 7006283 fixed wrong path to binary in debianized init script (reported as part of issue #57)
[email protected]{8}: On testing: zfsrc
[email protected]{9}: On testing: openmp import
Vous pouvez récupérer la dernière sauvegarde à partir d'une télécommande git, mais pas dans votre stock, seulement dans une autre référence. Quelque chose comme 'git va chercher un peu plus à distance + refs/stash: refs/remotes/some-remote/stash' le' git stash applique un peu distant/stash'. Mais vous ne pouvez pas obtenir des cachettes plus anciennes parce qu'elles sont stockées dans le reflog qui n'est pas fetchable. Voir http://stackoverflow.com/questions/2248680/can-i-fetch-a-stash-from-a-remote-repo-into-a-local-branch/29839687#answer-29839687 – sj26