I need a way to export a stashed change to another computer.
On computer 1 I did
$ git stash save feature
I'm trying to get the stash patch to a file and then import it to another computer
$ git stash show -p > patch
This command gives me a file that I can move to another computer where this repo is cloned, but the question is how to import it as a stash again.
You can apply a patch file (without committing the changes yet) by simply running
git apply patchfile
Then you can simply create a new stash from the current working directory:
git stash
You can create stash as patch file from one machine,then can share that patch file to another machines.
Creating the stash as a patch
$ git stash show "stash@{0}" -p > changes.patch
The “stash@{0}” is the ref of the stash.It will create patch file with latest stash.
If you want different one use command $ git stash list
to see your list of stashes and select which one you want to patch.
Applying the patch
Now transfer that stash to another machine and paste it into the root folder of your project. Then run this command
$ git apply changes.patch
If there is mistake and you want to reverse the change
$ git apply changes.patch --reverse
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With