본문 바로가기

Dev/Git

Git remove files completely from whole history

Clone repository with mirror option

git clone "remote/path" 

Use filter_branch to remove files

git filter-branch --force --tree-filter 'rm -f path/to/files.png' HEAD

Use filter_branch to remove directory

git filter-branch --force --tree-filter 'rm -rf path/to/directory' HEAD

Purge the unwanted data

git reflog expire --expire=now --all && git gc --prune=now --aggressive

Force push to the repository

git push --force

'Dev > Git' 카테고리의 다른 글

SVN -> Git migration  (0) 2019.12.23
Git LFS Migration  (0) 2019.12.03
Gitlab Install  (0) 2019.11.26