How to get latest code from Git on a server that has multiple Git branches?
I'm working on a project that has multiple Git branches in a repository hosted on GitHub.
I'm trying to find the lastest version of my project and have it available on my local machine, so I can continue working. However, the repository is shared among multiple users. So each user has their own branch, but they don't keep working on the same branch. They either add to their own branch, or create their own branch.
How do I get the latest code from GitHub, for example the latest branch, on my local machine?
Assuming that all branches are at the same commit (ie, they were merged), you can look at the git log output to see what the latest commit is.
If you want to work on that branch, you can use git checkout to switch branches.
If you are trying to do this without a Git client and using only git command line:
You can make a new branch by running git checkout -b latest and then update that branch by running git pull
In addition to already mentioned options, you can also checkout an arbitrary branch (including master, for example) as an orphan by running git checkout --orphan name.