0

I've been working on a computer and did some changes to my project. The thing is that, now, I have to work on another one. I haven't finished all I was doing, so I can't commit yet. How can I move all the directory to the new computer, without losing all my changes?

Thanks

1 Answers1

0

Even if you haven't finished your task, you can still commit. Simply commit all outstanding changes into a temporary branch (call it WIP-martins-change), and check out that branch on the second computer.

This has the additional upside that you can always go back to the known state during the transfer should you run into problems, and that you have a backup - that's why it's advisable to commit relatively often in general.

When you're done and want to create a nice pull request simply check out from the temporary branch to the permanent one (likely called something like feature-add-foobar-widget) and delete the temporary branch. If you are working in a single-person project without pull requests, you can also just (fast-forward) merge your changes into the main master branch.

phihag
  • 278,196
  • 72
  • 453
  • 469