To move uncommitted work to another machine or keep a copy of an experiment, save it as a patch. Before applying one, I’d let git check it first.
git diff > wip.patch
git apply --check wip.patch
The first line writes your unstaged changes to a file. Add --cached for staged changes or HEAD for both. On the other side, git apply --check tests whether the patch would apply, and changes nothing. No output means it would work; otherwise git names the file and line that don’t match.
Then apply it for real and look at what it would change:
git apply --stat wip.patch
git apply wip.patch
--stat lists the files and line counts without applying anything. The plain command applies the changes to your working tree, unstaged, like you had typed them yourself.
If the code moved on, git apply -3 tries a three-way merge and leaves conflict markers instead of refusing.
A plain git diff doesn’t include new untracked files, so stage them or use git add -N first, or they’re missing from the patch. Binary files need git diff --binary, otherwise the patch only says they differ. And this saves changes, not commits; for those, git format-patch is the better tool.
Further reading: git-apply documentation, git-diff documentation