First of all, you have to know the name of the remote server of your project, because if you want to get "different people's branches", they first have to push the branch to the server before you can pull it down. (Although it can also be obtained directly through local disk mapping or SSH, these are unconventional methods and should not be considered by you)
The second step is to grab the latest changes from the remote server. git pull origin 或者 git fetch origin Both are possible, the former will merge/rebase the tracked local branch directly (it depends on the merge strategy you set, this is not important)
The third step is to check the branch name you need. git branch -a,其中 remotes/ 开头的都是远程分支的名字,假设你想抓取的分支叫做 john-doe,那就应该是 remotes/origin/john-doe.
Finally checkout the branch and create the local corresponding branch. git checkout -b john-doe remotes/origin/john-doe,该命令会创建本地名为 john-doe's branch and automatically switch to it, so you get "different people's branches"
In practice, it doesn’t need to be so complicated, because you can directly ask “others” what the name of the pushed branch is, and then update + check it out.
You can try using Source Tree
First of all, you have to know the name of the remote server of your project, because if you want to get "different people's branches", they first have to push the branch to the server before you can pull it down. (Although it can also be obtained directly through local disk mapping or SSH, these are unconventional methods and should not be considered by you)
The second step is to grab the latest changes from the remote server.
git pull origin
或者git fetch origin
Both are possible, the former will merge/rebase the tracked local branch directly (it depends on the merge strategy you set, this is not important)The third step is to check the branch name you need.
git branch -a
,其中remotes/
开头的都是远程分支的名字,假设你想抓取的分支叫做john-doe
,那就应该是remotes/origin/john-doe
.Finally checkout the branch and create the local corresponding branch.
git checkout -b john-doe remotes/origin/john-doe
,该命令会创建本地名为john-doe
's branch and automatically switch to it, so you get "different people's branches"In practice, it doesn’t need to be so complicated, because you can directly ask “others” what the name of the pushed branch is, and then update + check it out.
What are branches of different people?
git checkout <branch name>
Can’t meet your needs?