git pull command
git pull The command is used to fetch code from a remote and merge it with the local version.
git pull It is actually shorthand for git fetch and git merge: first fetch the latest commit records from the remote repository, then merge those commit records into your current branch.
The command format is as follows:
git pull [远程仓库名] [分支名]
[远程仓库名]is usuallyorigin, which is the default name of the remote repository.[分支名]is the remote branch you want to merge, for examplemainormaster。
Example
Update operation:
$ git pull
$ git pull origin
Pull the master branch from the remote host origin and merge it with the local brantest branch.
git pull origin master:brantest
If the remote branch is merged with the current branch, the part after the colon can be omitted.
git pull origin master
The above command means fetch the origin/master branch, then merge it with the local brantest branch.
The above pull operation expressed with fetch is:
Take my https://github.com/tianqixin/runoob-git-test as an example, load from remote and merge into the local branch.
$ git remote -v # 查看信息
origin https://github.com/tianqixin/runoob-git-test (fetch)
origin https://github.com/tianqixin/runoob-git-test (push)
$ git pull origin master
From https://github.com/tianqixin/runoob-git-test
* branch master -> FETCH_HEAD
Already up to date.
The above command means fetch the origin/master branch, then merge it with the local master branch.
Git Basic Operations