Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export a stash to another computer

Tags:

git

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.

like image 552
Marcelo A Avatar asked Oct 19 '10 21:10

Marcelo A


People also ask

Can you share git stash?

You can create stash as patch file from one machine,then can share that patch file to another machines. 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.

Where is stash file stored?

All are stored in . git/refs/stash . git stash saves stashes indefinitely, and all of them are listed by git stash list . Please note that dropping or clearing the stash will remove it from the stash list, but you might still have unpruned nodes with the right data lying around.

How do I drop a git stash?

Go to Source Control tab. Check the STASHES section. You will find all your stashes (same like git stash list ) You will find direct buttons to Apply Stash, Compare with HEAD and Delete Stash respectively for each stash.

Can I pop stash in another branch?

It will make: a new branch (starting from the commit at which the stash was originally created) move changes to this branch. and remove latest stash (Like: git stash pop)


1 Answers

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 
like image 114
poke Avatar answered Oct 17 '22 19:10

poke