Reputation: 1778
Here's the situation. I have a cloned repo from GitHub on my host dev machine. Then on a virtual machine, I've cloned the sources from the host machine. Then I make changes to the source on the host machine, yet I want to run the source on VM. I do this because I crash the VM "a lot" and want to make sure I don't lose my source in case something goes corrupt as well as look at fixes while the VM boots up (as fs checks take a while sometimes).
So the issue is, how can I pull the changes I make to the source on the host without having to do commits for each and every change? Staging the changes doesn't seem to be enough. Is there another way so that I don't have to commit changes where all I'm doing is debugging?
Upvotes: 0
Views: 157
Reputation: 155438
without having to do commits for each and every change?
You can't. That's what commits are for. (Oversimplification warning) A commit is the atomic unit of git
. You can squash commits, of course, but you'll need to do that before you push
otherwise you'll break your refs on the remote machine.
If you have casual changes that you want to move-over but don't want to introduce to your "real" codebase then put the changes in a separate branch.
That said, git
is a tool for distributed source-control. It is not a tool for synchronizing ad-hoc code-changes between two machines for a work-in-progress (you can use it for this purpose, but it's not ideal). Ideally you'd use something like magic-wormhole (or your hypervisor's native file transfer utility) and/or rsync
to move code-state between machines.
Upvotes: 1