Export a stash to another computer
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
git stash is designed as a local convenience, not as a transport mechanism between machines. A stash is stored only in the local repository, so there is no built-in git stash push origin command. To move stashed work to another computer, the practical options are turning the stash into a patch, turning it into a branch and commit, or bundling that commit for transfer.
Option 1: export the stash as a patch
If you just want the changes and do not need full commit metadata, a patch file is often the quickest path.
That writes the diff from the stash into a patch file. Transfer the file to the other computer however you like, then apply it inside the target repository.
This method is simple and works well when both repositories are at compatible states. It is especially useful for one-off transfers where you do not want to create extra commits or branches.
Option 2: turn the stash into a branch
If the changes are more substantial, the better solution is usually to convert the stash into a normal Git branch and move that branch instead.
On the other computer:
This approach is safer than a raw patch because Git can track the branch history, you can merge or cherry-pick it later, and conflicts are handled through standard Git workflows instead of plain patch application.
Option 3: use git bundle when there is no shared remote
If the machines cannot share a remote repository, create a temporary commit and export it as a bundle.
Copy stash-transfer.bundle to the other computer and import it there:
Or, if you already have the target repository:
This works well when you are moving work by USB drive, file share, or some other offline mechanism.
Which option should you choose
Use a patch when:
- The change is small
- You only need the diff
- You do not care about preserving a branch or commit history
Use a temporary branch when:
- The stash is meaningful work
- You have a remote between the machines
- You want Git to manage history and conflicts normally
Use a bundle when:
- There is no shared remote
- You still want Git-native transfer instead of a raw patch
In practice, turning the stash into a branch is usually the cleanest method because it stops treating important work like something temporary.
Common Pitfalls
The most common mistake is assuming git stash itself is portable. It is not. The stash lives only in the local repository until you turn it into something transferable.
Another issue is forgetting untracked files. If the original stash was created without git stash -u, some files may never have entered the stash at all, so they will not appear in the exported patch or branch.
Patch application can also fail if the target repository is at a very different commit. In that case, a branch-based transfer is usually easier to recover from because Git has more context for merges.
Finally, do not leave critical work in stash for too long. If the work matters, commit it on a branch. Stash is best for short-lived interruptions, not long-term storage.
Summary
- A stash is local-only, so it cannot be sent directly to another computer.
- '
git stash show -plets you export a stash as a patch file.' - '
git stash branchis usually the cleanest way to turn a stash into transferable Git history.' - '
git bundleis useful when the two machines do not share a remote.' - If the work matters, prefer a branch and commit over keeping it in stash.

