I am trying to move uncommited changes from a local git repository to another local repository. On repo 1 I create a patch like this:
git diff > my_patch.patch
Inspecting the patch:
more my_patch.patch
I get the same output as running git diff
on the first repo.
In the second repo I run:
git apply --stat my_patch.patch
0 files changed
If I run git apply my_patch.patch
I get no effect.
Am I creating the patch wrong? Am I applying it wrong?
Steps to reproduce the issue:
- Clone a repository 2 times (same branch checkout)
- In first repo, make some changes to a file (uncommited).
- Create patch from changes:
git diff > ~/my_patch.patch
- Go to second repository. Try and apply patch:
git apply ~/my_patch.patch
- Run
git status
. No changes!
Suggesting another way of moving uncommited changes to another local repo would also be good to solve my issue.