git fetch Command
git fetch The command is used to fetch a code repository from a remote.
In this chapter we will use Github as the remote repository, so before reading this chapter you need to read the related content about Github:Git Remote Repository (Github)。
After this command executes, you need to execute git merge to merge the remote branch into your branch.
Fetch data from the remote repository and try to merge it into the current branch:
git merge
This command executes git merge right after git fetch to merge the remote branch into any branch you are on.
Suppose you have configured a remote repository and you want to fetch updated data; you can first execute:
git fetch [alias]
The above command tells Git to fetch the data it has that you don't have, and then you can execute:
git merge [alias]/[branch]
The above command merges any updates on the server (assuming someone pushed to the server at that time) into your current branch.
This chapter uses https://github.com/tianqixin/runoob-git-test as an example.
Next we click on Github README.md and modify it online:

Then we update the modifications locally.
$ git fetch origin
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:tianqixin/runoob-git-test
0205aab..febd8ed master -> origin/master
The above information "0205aab..febd8ed master -> origin/master" indicates that the master branch has been updated; we can use the following command to sync the updates locally:
$ git merge origin/master
Updating 0205aab..febd8ed
Fast-forward
README.md | 1 +
1 file changed, 1 insertion(+)
View the content of the README.md file:
$ cat README.md
# Runoob Tutorial Git Test
## First modification content
Git Basic Operations