Andrew Grimm Andrew Grimm - 1 month ago 19
Git Question

Is it possible to push a git stash to a remote repository?

In git, is it possible to create a stash, push the stash to a remote repository, retrieve the stash on another computer, and apply the stash?

Or are my options:


  • Create a patch and copy the patch to the other computer, or

  • Create a minor branch and commit the incomplete work to that branch?


Answer

It's not possible to get it via fetch or so, the mirror refspec is fetch = +refs/*:refs/*, and even though stash is refs/stash it doesn't get sent. An explicit refs/stash:refs/stash has no effect either!

It would only be confusing anyway since that wouldn't fetch all stashes, only the latest one; the list of stashes is the reflog of the ref refs/stashes.