I'm working on a django project with a few other developers and we have recently realized that all the .pwc files in our app cause the commits and repository to be cluttered.
Is there any way I can remove all .pwc files from all child directories in my git repository and then ignore them for any future commit?
Open the . git/info/exclude file in a text editor and add the folder to ignore. This file remains private to you.
Set “–assume-unchanged” to a path to exclude to check on git commit and it will exclude your file from git commit. You will need to use the git update-index and –assume-unchanged to exclude files from git commit.
A file with the GITIGNORE file extension is a Git Ignore file used with the version/source control system called Git.
Plenty of ways to remove them:
git ls-files | grep '\.pwc$' | xargs git rm find . -name *.pwc | xargs git rm
Note: If you haven't committed them, just use rm
, not git rm
.
To ignore them in the future, simply add *.pwc to the .gitignore. (If you don't have one, create a file named .gitignore at the top level of your repository, and just add a single line saying "*.pwc")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With