Accidentally, I have pushed the .pyc files to the master repository. Now I want to delete them but I can´t do it. Is there any way to remove them directly from the Bitbucket site?
gitignore are not being tracked, you can use the git clean command to recursively remove files that are not under version control. Use git clean -xdn to perform a dry run and see what will be removed. Then use git clean -xdf to execute it. Basically, git clean -h or man git-clean (in unix) will give you help.
The git rm command can be used to remove individual files or a collection of files. The primary function of git rm is to remove tracked files from the Git index. Additionally, git rm can be used to remove files from both the staging index and the working directory.
.pyc
files using git rm *.pyc
. If this not work use git rm -f *.pyc
git commit -a -m 'all pyc files removed'
git push
.pyc
files by creating a .gitignore
fileNo, you cannot delete them directly from the BitBucket interface but you can delete them in your local checkout and find ./ -type f -name '*.pyc' -exec git rm {} \;
( or simply git rm each pyc file one by one ). Then commit/push your changes.
Finally, to avoid ever making the same mistake again you may create a file at the root of your repo and name it '.gitignore' with the contents:
*.pyc *~ *.swp
*~ and ~.swp are other commonly forgotten file types that are often accidentally pushed. See the github doc on gitignore https://help.github.com/articles/ignoring-files (and their repo of .gitignore files for some nice defaults).
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