34
13
Is there a way to share a stash in git?
I work on a number of machines, and often want to be able to move my current working state from one to another.
I'm looking for a way that I can push/pull a stash from one clone to another, and have it appear either as the stash for the other clone, or as an apparent remote branch. I'm not expecting that the former will necessarily work if the remote already has stash of its own though.
Given that stash is, in effect, already a branch with commits on it (apparently), I'm not looking for solutions along the lines of "commit each stash to a branch and then share those" - I've already got many, many, branches. I'm therefore looking for the refspec or similar that I can use to control the push/pulling.
6
git push origin $(for sha in $(git rev-list -g stash); do echo $sha:refs/heads/stash_$sha; done)
should do nicely for all stashes; See also http://stackoverflow.com/a/5248758/85371 – sehe – 2016-02-25T15:00:04.150