Pull
remote 저장소에 있는 최신 커밋 상태를 local 저장소에 반영한다.
git pull
Fetch
remote 저장소에 있는 최신 커밋 상태를 local 저장소에 가져오기만 한다.
local 저장소와 remote 저장소를 비교할 수 있기에 충돌을 방지해 줄 수 있어 pull보다는 더 안전한 방법이다.
git fetch
git fetch -p //remote 저장소에서 더이상 존재하지 않는 reference를 삭제하고 fetch 한다.
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), 612 bytes | 153.00 KiB/s, done.
From https://github.com/insidedw/portfolio_gatsby
892b418..2fd0d17 main -> origin/main
커밋 상태 비교
git diff HEAD origin/main
diff --git a/blog/git-pull-vs-fetch/index.mdx b/blog/git-pull-vs-fetch/index.mdx
new file mode 100644
index 0000000..dd792f9
--- /dev/null
+++ b/blog/git-pull-vs-fetch/index.mdx
@@ -0,0 +1,34 @@
+---
+title: "pull vs fetch"
...
Merge
git merge origin/main
Reference
https://www.youtube.com/watch?v=V6R96Hzm8hY
'IT > git' 카테고리의 다른 글
GIT - Reset (0) | 2023.06.13 |
---|---|
GIT - Prune (0) | 2023.06.13 |
GIT - Commit (0) | 2023.06.13 |
GIT - Branch (0) | 2023.06.13 |
GIT - Add (0) | 2023.06.13 |