Issue 641 mentions the same issue.
I tried to stop using Git LFS, but found no way to revert my previous tracked pointer files using git lfs uninit
, git lfs untrack
, git rm
... after I move those files back it still lists as tracked by Git LFS with git lfs ls-files
, how can I opt out the whole Git LFS stuff from my repo?
The answer was:
- Remove all filter.lfs.* git config entries with
git lfs uninit
.
- Clear any any attributes that use the lfs filter in
.gitattributes
by running git lfs untrack
for each file type, or deleting .gitattributes
if LFS is all you ever used it for.
After this, any added files will go straight to git.
But this was not so simple:
I later end up LFS pointer files in my working directory and have to recover all my pictures from .git/lfs
using the sha1 hash stored in those pointers manually.
Update March 2016, the issue 957 illustrates a possible solution by tstephens619
:
I made the same mistake of including several small graphics formats into my git lfs
tracking list.
I was able to move this files back into git by doing the following:
Create a list of all of the files currently being tracked by git-lfs
, filter out *.gz
and *.rpm
(I want to still track those extensions with git-lfs
)
git lfs ls-files | grep -vE "\.gz|\.rpm$" | cut -d ' ' -f 3 > ~/temp/lfs-files.txt
Stop tracking the small graphics files
git lfs untrack "*.tts"
git lfs untrack "*.bfx"
git lfs untrack "*.ttf"
git lfs untrack "*.xcf"
git lfs untrack "*.pkm"
git lfs untrack "*.png"
Temporarily uninit git-lfs
git lfs uninit
# Git LFS 2.x+
git lfs uninstall
Use the file list to touch each file:
cat ~/temp/lfs-files.txt | xargs touch
git status
will now show each file as modified
The maintainer ttaylorr
adds:
One way to do this would be:
for file in $FILES_TO_REVERT; do
git lfs untrack "$file";
git rm --cached "$file";
git add --force "$file";
done
git commit -m "..."
My preference would be not to add a command to Git LFS to the above effect, since it is possible in a number of different way with the porcelain commands provided by Git and Git LFS