We have a situation where were are using git to stash myriad scans (images) and do not wish to preserve them on the local machine once set on up; however, git is seeing each loc
The git-update-index(1) command provides some ways of dealing with this. Based on the assumption that you want to keep the blobs in your history while deleting them from your working tree, you could use the following:
git add --all
git commit --message="Add new assets to repository."
git update-index update-index --skip-worktree
rm
Note that the last line isn't a Git command because you're removing the files from the working tree in the shell after you've stored them in the index. Don't use git rm
by mistake, because it operates on the index.
To see the files you've marked with the skip-worktree bit:
git ls-files -v | awk -v IGNORECASE=1 '$1 ~ /s/ {print}'
You can also use git-ls-files(1) to find files in the index that have been removed from your working tree.