I had a broken .gitignore file in my repository so other files also got commited.
According to the post below I removed those unnecessary files and my repo looks clean however since then every time I do a git pull those files (meant to be ignored) get physically deleted from the directory.
Remove directory from remote repository after adding them to .gitignore
I worked out a fix:
- copy the old tree
- remove .git
- git init
- git remote add a_new_repository
- make a change just for the sake of a commit
- git add .
- git commit
- git push
However this way I lose previous commits.
Is there a less painful way?
Thanks
EDIT
So the command I used were:
- git rm -r --cached some-directory
- git commit -m 'Remove the now ignored directory "some-directory"'
- git push origin master
Then after git pull I get a long list of removed files
...
delete mode 100644 themes/stark/README.txt
delete mode 100644 themes/stark/layout.css
delete mode 100644 themes/stark/logo.png delete mode 100644 themes/stark/screenshot.png
delete mode 100644 themes/stark/stark.info
delete mode 100644 update.php
delete mode 100644 web.config
delete mode 100644 xmlrpc.php