I currently have two copies of the same Git project checked out on my machine. I'm aware that traditionally one would not do that; it's more typical to have the project checked out once and switch branches as needed. The primary reason I have the second copy so that I can review merge requests locally — within my IDE, as well as by running the code — without having to context switch out of whatever work I might be in the middle of. That work might not be in a state where it's convenient for me to stash, or commit, or stop running a long running process.
I accidentally made some changes to the wrong copy of my project locally, and want to move them to the correct copy.
I know that I can create a branch, push them to the server, check them out on the other branch, and then delete the remote branch. This isn't too terribly onerous.
cd /path/to/source-project
git switch -c myTempBranch
git push -u origin myTempBranch
cd /path/to/other-project
git pull
git merge myTempBranch
git push -d origin myTempBranch
That being said, the changes aren't ready for anyone else's consumption quite yet, and it would be nice if I could do this all locally without having to get the remote server involved.
Is there a way to apply a series of commits from one checked out get project to a different copy of that project without pushing it?