I have two computers(computer 1 and computer 2), one at work and one at home.
Both computers are connected to the same Github repository.
I forgot to commit the code after writing in computer 1. Now I'm using computer 2 and I want to get the uncommitted code in computer 1 so I can synchronize the content by committing the code in computer 1 first, and then start writing code in computer 2. Is there's a way I can do that?
CodePudding user response:
No. The way the workflows usually goes is that you pull new commits from the github repository, write some code, commit it, and then push the commits to the github repository. At no point is github able by itself to go and fetch directly data on any computer: you need to push it. (think about it: if github could read from your computer data that you haven't decided to send, this would be a major security problem).
Your best bet is to connect to computer 1 via remote desktop protocols or SSH, commit and push your code there.
Alternatively, if you plan to work on parts of the project that are not exactly located in the same place as your uncommitted work, just work and commit from computer 2, and pull from computer 1 when you come back to work.
CodePudding user response:
If you can remote in to your pc at work, do so. Then commit and push the code yourself. Or you might create something like this next time in case you forgot to commit/push your codes, let's say on a temp branch.