I'm using Git and sometimes i start my work on my local desktop and i want to copy these open works to my laptop to finish it at home.
To keep my repository clean, i don't want to push these changes to some branch because my work may be unfinished, untested an so on...
Just type git checkout a . Or perhaps more usefully, git checkout -b mybranch a , to checkout a as a new branch mybranch . If you want to revert b and c , you can use git revert , or to remove them entirely from your current branch's history, you could git rebase -i a and throw them out.
This is my workflow to copy my changes from one PC to another:
Stash your changes with:
git stash save myWork
Save stash to file with:
git stash show -p > myWork.txt
Move generated file (myWork.txt) to other PC Patch new PC with:
git apply myWork.txt
Clear all Stash:
git stash clear
You're over-complicating the problem, all what you need to do is:
At work
git checkout -b temp_branch
git push origin temp_branch
At home
git fetch && git checkout temp_branch
Then delete it:
git branch -d temp_branch
git push origin :temp_branch
For extra cleaning, you can prune the deleted branch
git remote prune temp_branch
Don't be afraid of creating branches, they're very cheap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With