Reputation: 988
So basically this is a pretty "nooby" question but how would I get the latest version of my code from a GitHub repo? In my case, I code on both PC and Mac but I'd like to work on a project on both machines. For example, say if I started a project on PC, coded something and pushed it onto GitHub, then cloned that GitHub repo onto my Mac and coded some more and pushed that code to Github. How would I now update the code on my PC to match the code in the GitHub repo and vice-versa? Thank You!
Upvotes: 3
Views: 5780
Reputation: 613
To update the code on my PC to match the code in the GitHub repo use
$ git pull origin <branch_name>
if you want to update specific branch
and run the same command on your Mac to get the changes that you updated to Github
by using
$ git log
which shows the commit id and other details, by matching the head commit in both local and remote you can verify that you cloned the latest sources
Upvotes: 1
Reputation: 356
If what you are looking for is to know the latest commits that have been done on that repo you should go for
git log --all --oneline
This will list in chronological order all the commits of the repo starting from the most recent one. Instead if you want to look for a stable version of the code you should probably do
git pull origin master
where by convention usually you can find the latest stable version. Beware that this may not be true everywhere and people is not obliged to follow this convention.
Upvotes: 3
Reputation: 468
Probably:
git pull origin master
If your default branch is different than master, you will need to specify branch name :
git pull origin default_branch_name
Upvotes: 1