zhasper@berens:/media/Kindle/documents$ git helpusage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]
The most commonly used git commands are:add Add file contents to the index:rm Remove files from the working tree and from the index
[~/www]$ git rm shop/mickey/mtt_flange_SCN.7z.003error: 'shop/mickey/mtt_flange_SCN.7z.003' has local modifications(use --cached to keep the file, or -f to force removal)[~/www]$ git rm -f shop/mickey/mtt_flange_SCN.7z.003rm 'shop/mickey/mtt_flange_SCN.7z.003'[~/www]$[~/www]$ git status# On branch master# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)## deleted: shop/mickey/mtt_flange_SCN.7z.003## Changed but not updated:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in working directory)## modified: shop/mickey/mtt_flange_SCN.7z.001# modified: shop/mickey/mtt_flange_SCN.7z.002[~/www]$ ls shop/mickey/mtt_flange_S*shop/mickey/mtt_flange_SCN.7z.001 shop/mickey/mtt_flange_SCN.7z.002[~/www]$[~/www]$[~/www]$ git rm --cached shop/mickey/mtt_flange_SCN.7z.002rm 'shop/mickey/mtt_flange_SCN.7z.002'[~/www]$ ls shop/mickey/mtt_flange_S*shop/mickey/mtt_flange_SCN.7z.001 shop/mickey/mtt_flange_SCN.7z.002[~/www]$[~/www]$[~/www]$ git status# On branch master# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)## deleted: shop/mickey/mtt_flange_SCN.7z.002# deleted: shop/mickey/mtt_flange_SCN.7z.003## Changed but not updated:# modified: shop/mickey/mtt_flange_SCN.7z.001[~/www]$
git filter-branch --force --index-filter \ "git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA" \ --prune-empty --tag-name-filter cat -- --all# Replace PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA with the path to the file you want to remove, not just its filename