Post

[Git] Local Branch를 Remote와 동기화하는 법

필요성

저번에 작업을 하는데 갑자기 Local과 Remote가 서로 다른 버그가 있었습니다. 아무리 pull, merge를 해도 해결되지 않아서 검색하게 되었습니다.

방법

1.git fetch

git fetch를 이용해서 우선 Remote의 커밋들을 가져옵니다.

1
git fetch origin

2.git reset –hard

git reset –hard를 이용해서 리셋해줍니다.

1
git reset --hard origin/main

참고: Stack Overflow

This post is licensed under CC BY 4.0 by the author.