[面試題] git clonegit fetch 和 git pull 的差別

Mino chen
Jan 25, 2021

--

當你想要從 GitHub 下載一份全新的專案下來本機時,會使用

git clone 再加上專案的連結

接下來第二次想要更新雲端的檔案進度下來本機,可以使用 git pull 這個指令。

我很少使用 git fetch 這個指令,因為 git fetch 只有將遠端分支跟本機分支不同的地方,拉下來而已,並沒有做 merge,如果我使用這個指令,還要另外自己做 merge (我懶),所以我通常都用 git pull。

整理一下:

新專案拉下來 git clone →

之後要再同步遠端跟本地的專案 git pull

git pull = git fetch + merge

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Mino chen
Mino chen

No responses yet

Write a response