git

git 변경내용 가져와 사용하기

muyeon 2023. 5. 4. 14:29
# 원격 저장소의 변경사항을 local 저장소로 가져온다.
git fetch <remote>

# pull
git pull origin main

git fetch origin main

# remote 저장소로부터 가져온 branch 의 head
# git fetch 명령이 실행되면 remote 저장소에서 가져온 모든 branch head 를 .git/FETCH_HEAD 파일에 저장한다.
# git fetch 이후에만 유효 -> 최신 commit 을 참조할 때 유용

git merge FETCH_HEAD

# branch 최신화
git checkout <branch>
git reset --hard <remote>/<branch>

참조: https://gwpaeng.tistory.com/317