git remove file code example

Example 1: delete git

rm -rf .git

Example 2: git remove folder remotely

git rm -r --cached <folder>
git commit -m "Removed Folder"
git push origin master

Example 3: git remove file from history

$ git rm --cached giant_file
# Stage our giant file for removal, but leave it on disk

Example 4: git rm cached

$ git rm --cached filename

Example 5: how to remove file changes in git

git clean -df
git checkout -- .

Example 6: git remove file

git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch]
	  [--quiet] [--pathspec-from-file=<file> [--pathspec-file-nul]]
	  [--] [<pathspec>]