Today I Learn/Git

[git] git pull 덮어쓰기

단추언니 2021. 9. 28. 17:01
반응형

로컬에 있는 모든 내용을 원격저장소의 내용으로 덮어쓰려는 경우 사용

git pull 덮어쓰기

$ git fetch --all
$ git reset --hard origin/master

master가 아닌 다른 branch로 덮어쓰기

$ git fetch --all
$ git reset --hard origin/<branch>

현재 로컬 커밋을 다른 branch에 저장한 후, git pull로 덮어쓰기

$ git checkout master
$ git branch <branch>
$ git fetch --all
$ git reset --hard origin/master
반응형