Skip to content

Removing a file from git without removing it from local

  • by

Many times while doing an initial commit we accidentally adds `.classpath`, `.project` or other unwanted files.
but later on some point of time we want to remove it.

So here are some examples of removing then from git but not from local filestore

Removing single file

git rm --cached .classpath<br>
git rm --cached .project<br>

Removing a directory

git rm --cached -r .log<br>

after removnig simply commit the changes

git commit -m "remove unwanted files from repo"<br>
git push origin master<br>


Leave a Reply

Your email address will not be published. Required fields are marked *