Files
dotfiles/scripts/shell/job/git-lfs-undo.sh

35 lines
956 B
Bash
Executable File

#!/bin/bash
repo_dir=`pwd`
cd $repo_dir
# method 1
# source: https://github.com/git-lfs/git-lfs/issues/3026
# lfs_files=`git lfs ls-files | awk -F' ' {'print $3'}`
# for f in ${lfs_files[@]}; do
# git rm --cached $f # "remove" the lfs file
# git add $f # add the "normal" file
# done
# gitattr_filename='.gitattributes'
# if [ -f "$gitattr_filename" ]; then
# rm --force $gitattr_filename
# git add $gitattr_filename
# fi
# git commit -m "restore files from lfs"
# method 2
# source: https://stackoverflow.com/questions/35011366/move-git-lfs-tracked-files-under-regular-git/54119191#54119191
# git lfs untrack "*"
# git add --renormalize .
# git commit -m "Restore file contents that were previously in LFS"
# method 3
# source: https://gist.github.com/everttrollip/198ed9a09bba45d2663ccac99e662201?permalink_comment_id=3695821#gistcomment-3695821
git-lfs uninstall --local && echo " " > .gitattributes && git add --renormalize .