개발도구
Git ] 원격 저장소에 강제 push 하기 (remote를 local로 덮어쓰기)
eteo
2023. 1. 25. 18:22
반응형
local의 내용을 remote에 강제로 덮어쓰는 방법
git push <remote> <branch> -f
git push origin master -f # Example
원격 저장소의 commit 정보가 유실될 수 있으니 -f(-force) 플래그를 붙이는데는 주의가 필요하다.
remote에 예상 못한 commit이 있는 경우 force push가 실패하도록 하는 방법도 있다.
git push <remote> <branch> --force-with-lease
Reference : https://stackoverflow.com/questions/10510462/force-git-push-to-overwrite-remote-files
반응형