1

I have two computers, one at home and another one at office.

When I am working at the office, I make some changes and create a new pull request, push the change to that pull request( although not ready for merge yet). And I am off work and go back home, I change to the computer at home.

How could I pull the change on that pull request and continue working at home? Also if I have added some more change on that pull request, how can I the second day pull that change at office, using the first computer?

Anthonyeef
  • 2,595
  • 1
  • 27
  • 25

2 Answers2

3

Say, you created a branch called feature1. Then created a pull request from the feature1 branch. Now, when you push the changes to feature1, the pull request would be automatically updated.

You just need to pull the feature1 branch to get the latest changes:

$ git checkout <branch-name>
$ git pull origin <branch-name>

If you push over SSH, you neeed to add your home machine’s public key (~/.ssh/id_rsa.pub) to your office’s GitHub account.

ib.
  • 27,830
  • 11
  • 80
  • 100
Sajib Khan
  • 22,878
  • 9
  • 63
  • 73
  • can I edit it after pull on another computer? Is it read-only or I can have access to write? – Anthonyeef Apr 22 '17 at 06:43
  • Yes, you can if you have write permission (maybe, need to log in with your office mail or else) – Sajib Khan Apr 22 '17 at 06:45
  • To Push you need, username/password (for HTTPS) Or, add home machine's SSH key in office-github-account (for SSH) – Sajib Khan Apr 22 '17 at 06:57
  • Though I havn't try this answer, I think this should be correct(and I seems like asking a duplicated question). Thank you for your patience. – Anthonyeef Apr 22 '17 at 07:03
0

You can create your own branch at work, and sync between that and the main branch while coding.

At home, checkout from your private branch. When you pull, you will get the changes on your private branch which you commited locally.

When you want to push, push from home to private, consolidate the changes, then push private to main.

More on that here:

How do I check out a remote Git branch?

Community
  • 1
  • 1
didiz
  • 1,069
  • 13
  • 26