awk - Use .gitignore to find if any files are cached in git -
my team using visual studio , accidentally pushed without using .gitignore. have .gitignore in place, however, files stilled stored in git cache. want search directory find these files
i imagining doing like
awk '/$/ {print $1} .gitignore | xargs git rm'
or, since don't want test deleting everything, safer this
awk '/$/ {print $1} .gitignore | xargs find -iname'
but i'm off. can me?
git ls-files
friend here.
git ls-files --exclude-standard -ic \ | xargs git rm --cached
@aurelianus's answer simpler , better if unstaged changes aren't concern.
Comments
Post a Comment