git remove without deleting 1

git remove without deleting

For a single file:

git rm --cached mylogfile.log

and for a single directory:

git rm --cached -r mydirectory

Here is what the above code is Doing:
1. git rm –cached mylogfile.log
– This command removes the file from the staging area, but leaves the file on disk.
2. git commit -m “Remove log file from repository”
– This commits the removal of the file from the staging area.
3. git push origin master
– This pushes the commit to the remote repository.

Similar Posts