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?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
I used simeg's solution but also wanted to deleted tons of *.pyc files added by mistake to a branch. I used awk to delete them from cache recursively.
Then, I deleted the files from my local
Because in default Bitbucket, there is no .gitignore file in the repo,so you can do :
Quick way with PyDev for eclipse.
Go to the PyDev Package Explorer of your project and do:
right click + Pydev / Remove *.pyc *.pyo and *$py.class File
Optional: Commit your change to the team/server:
In the commit window you shouldn't see any .pyc available to add as we deleted them. Also if you committed such files before then you should be able to commit their "deletion" now.
===> Your local and server repository are now free of *.pyc *.pyo and *$py.class File :)
.pyc
files usinggit rm *.pyc
. If this not work usegit rm -f *.pyc
git commit -a -m 'all pyc files removed'
git push
.pyc
files by creating a.gitignore
fileA one-liner for fun:
git status | grep pyc | sed -e 's/ new file: //g' | xargs -I {} git rm --cached {}
another liner for fun to remove all the pyc files.
find . -name '*.pyc' -exec git rm {} \;
don't forget to follow the steps in other answers to commit and add gitignore.