Skip to content
Home » Removing a file from git without removing it from local

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

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

Removing a directory

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

after removnig simply commit the changes

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

test

Leave a Reply

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