버전관리시스템/Git&Github
[Git] 원격저장소(remotes)에 commit된 branch 지우기
Gongdel
2018. 6. 8. 17:50
작업 완료 후 원격저장소에 push까지 마친 후 잘못 수정한 부분이 발견됐다.
revert로 돌린 후 흔적을 남겨도 되지만(이게 더 안전하고 편하긴하지만..) 흔적없이 지우기 위해서는 reset이 필요하다
sourcetree의 reset은 local branch만 reset이 되는 거 같아(아닌 수도...) 찾아보게 되었다.
=========================================================================
<터미널 명령어>
git reset --hard <commit-hash>
git push -f <remote> <local branch>:<remote branch>
ex) git reset --hard 343cf3 - reset할 위치의 commit-hash
git push -f origin test:master
원격저장소 로컬브런치:원격저장소 브런치
출처 : https://stackoverflow.com/questions/5816688/resetting-remote-to-a-certain-commit