2019년 9월 9일 월요일

master가 오염된 채, push가 안될 때


음, 꼬였다. 하지만 진실은 저편이 아니라 내쪽이다. 

Your branch and 'origin/master' have diverged,
and have 35 and 29 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)


그래서 orign master를 갈아엎으려

git push origin master -f

했으나

remote: error: File android/java_pid72657.hprof is 514.38 MB; this exceeds GitHub's file size limit of 100.00 MB

이런 덩어리가 들어 있었다. 이렇게 잘못 commit된 놈은 뽑아내자.

git filter-branch --tree-filter 'rm -rf android/java_pid72657.hprof' HEAD

그랬더니

Cannot create a new backup.
A previous backup already exists in refs/original/
Force overwriting the backup with -f

음, 아래와 같이 백업을 날려 준 뒤, 

git update-ref -d refs/original/refs/heads/master

다시 

git push origin master -f

끝.

댓글 없음:

댓글 쓰기