Hinweis: ich gerade diese Antwort mit 24 Stunden mehr git-fu unter meinem Gürtel neu geschrieben habe :) In meiner Shell-Geschichte ist der ganze Kram jetzt drei Einzeiler. Allerdings habe ich sie für Ihre Bequemlichkeit nicht aufgelöst.
Auf diese Weise hoffe ich, dass Sie sehen können, wie ich Dinge gemacht habe, anstatt nur blind Dinge kopieren/einfügen zu müssen.
Hier ist Schritt für Schritt.
Angenommen, es handelt sich um eine Quelle in ~/OLDREPO-haltigen Magazinen. Erstellen Sie einen Test Klon enthält keine stashes:
cd ~/OLDREPO
git clone . /tmp/TEST
Drücken alle stashes als Temp Zweige:
git send-pack /tmp/TEST $(for sha in $(git rev-list -g stash); \
do echo $sha:refs/heads/stash_$sha; done)
Schleife auf der Empfängerseite in stashes zu verwandeln zurück:
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
Cleanup Ihre temporäre Zweige, wenn Sie werden
git branch -D $(git branch|cut -c3-|grep ^stash_)
eine git stash Liste tun und Sie werden so etwas wie diese:
[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
Auf der Original-Repository, das gleiche sah aus wie
[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
Sie können den neuesten Stash von einer Git-Fernbedienung holen, aber nicht in Ihr Versteck, nur in eine andere Referenz. So etwas wie 'git fetch some-remote + refs/stash: refs/remotes/some-remote/stash' das' git stash apply some-remote/stash'. Sie können jedoch keine älteren Speicherbereiche abrufen, da sie im Reflog gespeichert sind, der nicht abgerufen werden kann. Siehe http://stackoverflow.com/questions/2248680/can-i-fetch-a-stash-from-a-remote-repo-into-a-local-branch/29839687#answer-29839687 – sj26