-2

I am pretty new to git so I don't exactly know how to do this or what its called but I will try and explain.

I started a repo on my main computer, but today I cloned the repo on my work computer, changed a few things and commit ed my changes to the GitHub. What I need to do now is get what I did on my work computer on to my main computer, how can I do this?

Already tried using google, but as I said, I don't even know what to search for as I don't have a good understanding of GitHub as it is.

Liam Savage
  • 167
  • 12

2 Answers2

0

If you've already cloned the repo on your main computer, all you need to do is get the latest changes. You can do that with

git pull

Once you've made more commits, be sure to sync them with GitHub by pushing them.

git push origin
bejado
  • 1,430
  • 12
  • 19
  • Wouldnt he want to start using fork if multiple users were working on this project? Just curious as to what you would do. – yardpenalty.com Mar 03 '17 at 06:28
  • ["fork" is GitHub's terminology, not Git's](http://stackoverflow.com/questions/6286571/are-git-forks-actually-git-clones). Multiple people can work on the project by cloning it, commiting changes, and then pushing to GitHub. It is up to the GitHub owner to allow other users to push commits. – bejado Mar 03 '17 at 06:29
  • OK thanks for the clarification. I was just wondering if multiple users had different versions but both had viable updates how that would be managed successfully. I take it that GitHub can identify these discrepancies or something? – yardpenalty.com Mar 03 '17 at 06:32
  • 1
    Each user's makes a [Pull Request](https://help.github.com/articles/about-pull-requests/) with their changes. These are then applied one at a time. If there are conflicts, the original author would need to resolve them. – bejado Mar 03 '17 at 06:35
0

Assuming all of your remotes are set up correctly, your remotes name is "origin", and the branch is "master" then it's simple.

[me@main ~/projects/myproject] # git pull origin master

Run this command from within your main computer and it will pull down the changes.

If you run into issues, it might be conflicts and if this is the case, it is out of scope of this question.

ddavison
  • 28,221
  • 15
  • 85
  • 110