본문 바로가기

Dev/Git

Git LFS Migration

Git None LFS Repository -> Git LFS Repository

기존 저장소를 Mirror Clone
git clone --mirror old_url
기존 저장소에서 LFS로 변환하고 싶은 확장자를 포함하여 모든 브랜치에 대해 변환 수행
git lfs migrate import --include="*.[dD][oO][tT], *.[rR][tT][fF], *.[dD][oO][cC], *.[dD][oO][cC][xX], *.[pP][dD][fF], *.[xX][lL][sS], *.[xX][lL][sS][xX], *.[xX][lL][sS][mM], *.[pP][pP][tT], *.[pP][pP][tT][xX], *.[iI][pP][cC][hH], *.[sS][dD][fF], *.[sS][uU][oO], *.[dD][bB], *.[tT][xX], *.[dD][lL][lL], *.[eE][xX][eE], *.[lL][iI][bB], *.[jJ][pP][gG], *.[jJ][pP][eE][gG], *.[bB][mM][pP], *.[pP][nN][gG], *.[iI][cC][oO], *.[sS][dD][bB], *.[gG][iI][fF], *.[mM][sS][iI], *.[dD][sS][dD][pP], *.[dD][bB][sS], *.[oO][cC][xX], *.[dD][wW][gG], *.[eE][mM][fF], *.[iI][lL][kK], *.[tT][gG][aA], *.[aA][vV][iI], *.[wW][mM][vV], *.[wW][aA][vV], *.[mM][oO][vV], *.[mM][pP]3, *.[mM][pP]4, *.[oO][gG][vV], *.[xX][lL][lL], *.[sS][wW][fF], *.[dD][rR][vV], *.[pP][sS], *.[pP][sS][dD], *.7[zZ], *.[cC][aA][bB], *.[eE][aA][rR], *.[gG][zZ], *.[jJ][aA][rR], *.[rR][aA][rR], *.[tT][aA][rR], *.[tT][gG][zZ], *.[wW][aA][rR], *.[zZ][iI][pP], *.[pP][yY][dD], *.[pP][yY][lL], *.[pP][yY][cC], *.[pP][yY][oO], *.[pP], *.[tT][tT][fF], *.[sS][hH][xX], *.[fF][nN][tT], *.[oO][tT][fF], *.[jJ][mM][eE][bB]" --everything --verbose;
History 정리
git reflog expire --expire=now --all
git gc --prune=now --aggressive
LFS Install
git lfs install
case 1. 기존 저장소에 강제 푸시
git push --mirror -f
case 2. 새로운 저장소로 설정한 후 푸시
git remote set-url --push origin new_url
git push --mirror

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

SVN -> Git migration  (0) 2019.12.23
Git remove files completely from whole history  (0) 2019.12.02
Gitlab Install  (0) 2019.11.26