---
# System prepended metadata

title: Git - pull 下載遠端數據庫
tags: [Git]

---

# Git - pull 下載遠端數據庫

## git pull

git pull 可以讓我們即時更新遠端數據庫的資料到本地端

例如這是同事A的 git log，有兩筆 commit 紀錄，並且已經 push 到遠端數據庫

```git
design1@DESKTOP-2SJKDSH MINGW64 ~/Desktop/a/gittest2 (master)
$ git l
* fc45e18 (HEAD -> master, origin/master) add b
* 5e67ee4 add index

design1@DESKTOP-2SJKDSH MINGW64 ~/Desktop/a/gittest2 (master)
$ git push origin master
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 233 bytes | 233.00 KiB/s, done.
Total 2 (delta 0), reused 0 (delta 0)
To https://github.com/GeneHuang331/gittest2.git
   5e67ee4..fc45e18  master -> master


```

但是我的本地端依然只有一筆紀錄

``` git
design1@DESKTOP-2SJKDSH MINGW64 ~/Desktop/my/gittest2 (master)
$ git l
* 5e67ee4 (HEAD -> master, origin/master) add index

```

此時我想要更新遠端數據庫的最新狀況 我可以使用 **git pull** 下載

``` git
design1@DESKTOP-2SJKDSH MINGW64 ~/Desktop/my/gittest2 (master)
$ git pull
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 2 (delta 0), pack-reused 0
Unpacking objects: 100% (2/2), done.
From https://github.com/GeneHuang331/gittest2
   5e67ee4..fc45e18  master     -> origin/master
Updating 5e67ee4..fc45e18
Fast-forward
 b.html | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 b.html

```

再用 **git log** 查，已經更新到最新狀況了

``` git
design1@DESKTOP-2SJKDSH MINGW64 ~/Desktop/my/gittest2 (master)
$ git log
commit fc45e18d20e8b34534bb1b57435e1944324801e2 (HEAD -> master, origi
Author: Gene <gene.huang@esit.com.tw>
Date:   Thu Apr 1 17:02:00 2021 +0800

    add b

commit 5e67ee4c52f7a617117227ce06c5ce811e1076ca
Author: Gene <gene.huang@esit.com.tw>
Date:   Thu Apr 1 16:58:21 2021 +0800

    add index
```

###### tags: `Git`