Here’s an example of how to remove every *.pyc file from every commit in Git history. It is adapted from this Git help page.
git filter-branch, forcing (
--force) Git to process—but not check out (
--index-filter)—the entire history of every branch and tag (
--tag-name-filter cat -- --all), removing the specified files (
'git rm --cached --ignore-unmatch *.pyc') and any empty commits generated as a result (
--prune-empty). Continue reading Remove Unwanted Files From Git History
git clean -df
git checkout — .
Here’s a little script I made to make it easy to put a number of existing web sites residing under /var/www under version control by Git. Regarding security, it is obviously not a good idea to initialize the Git repository directly under the site directory, since from there it might be served by the web server to the outside world. And that is not what I want. Instead what I want is to have the Git working directory directly in the site directory that is served, and the repository somewhere else. That is perfectly possible with Git, just by setting one or two environment variables. Continue reading Adding Git version control to web sites
Ignoring files · GitHub Help · Global .gitignore
git rm -r --cached *
That will recursively remove every file from the index (files staged for commit).