Git Pull
# git pull Command
[Git Basic Operations](#)
* * *
**git pull** command is used to fetch code from remote and merge it with the local version.
**git pull** is actually a shorthand for git fetch and git merge. It first fetches the latest commit records from the remote repository, and then merges those commit records into your current branch.
Command format:
git pull
* `` is usually `origin`, which is the default remote repository name.
* `` is the remote branch you want to merge, such as `main` or `master`.
### Example
Update operation:
$ git pull $ git pull origin
Fetch 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 to be merged with the current branch, the part after the colon can be omitted.
git pull origin
The above command means fetching the origin/master branch and then merging it with the local brantest branch.
The above pull operation can be represented with fetch as:
Take my [ as an example, fetch from remote and merge with local branch.
$ git remote -v # View information origin (fetch) origin (push) $ git pull origin master From * branch master -> FETCH_HEAD Already up to date.
The above command means fetching the origin/master branch and then merging it with the local master branch.
* * Git Basic Operations](#)
YouTip