Vasos Koupparis

How to share a git stash with another developer or yourself to another machine

Creating the stash as a patch

The following git command will create a patch file that contains all the differences represented by the set of changes in the stash.

					$ git stash show "stash@{0}" -p > changes.patch

The “stash@{0}” is the ref of the stash.

If you want a different one just use $ git stash list to see your list of stashes and select which one you want to patch.

Applying the patch

Transfer/Send the patch file generated from one machine to the other and drop it into the root of your project directory.

Then the following command will do all the magic!!! KEEP ON HACKING!

					$ git apply changes.patch

Reversing the patch

					$ git apply changes.patch --reverse

Follow Me

Recent Post