Skip to content

Instantly share code, notes, and snippets.

@kotashiratsuka
Last active April 20, 2016 16:12
Show Gist options
  • Save kotashiratsuka/6ebfa55c5585853ee62b569a41ac33ac to your computer and use it in GitHub Desktop.
Save kotashiratsuka/6ebfa55c5585853ee62b569a41ac33ac to your computer and use it in GitHub Desktop.
# 基本形
git lfs init
git lfs track "*.rpm"
git lfs track "*.srpm"
git lfs ls-files
git add -A
git commit -m 'Adding $file lfs style'
# *.xxx のファイルを全てLFSへ移行 ref https://github.com/github/git-lfs/issues/326
git filter-branch -f --prune-empty --tree-filter '
git lfs track "*.jpeg"
git lfs track "*.png"
git lfs track "*.gif"
git lfs track "*.ppt"
git lfs track "*.pptx"
git lfs track "*.psd"
git lfs track "*.key"
git lfs track "*.jpe"
git lfs track "*.jpg"
git lfs track "*.ai"
git lfs track "*.pdf"
git add .gitattributes
git ls-files -z | xargs -0 git check-attr filter | grep "filter: lfs" | sed -E "s/(.*): filter: lfs/\1/" | tr "\n" "\0" | while read -r -d $'"'\0'"' file; do
    echo "Processing ${file}"
    git rm -f --cached "${file}"
    echo "Adding $file lfs style"
    git add "${file}"
done
' --tag-name-filter cat -- --all
git push origin HEAD -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment