git remove history of deleted files code example
Example 1: git remove file from history
$ git rm --cached giant_file
Example 2: remove file history from git
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD
Example 3: how to remove git history for a file
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD
Example 4: git list deleted files
git diff --name-status
Example 5: remove git deleted files
git add . => Add all (tracked and modified)/new files in the working tree.
git add -u => Add all modified/removed files which are tracked.
git add -A => Add all (tracked and modified)/(tracked and removed)/new files in the working tree.
git commit -a -m "commit message" - Add and commit modified/removed files which are tracked.