Remove a file from a Git repository without deleting it from the local filesystem
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
You must login to ask question.
Ignore the files, remove the files from git, update git (for the removal).
1) Ignore the files
.gitignore
to ignore them – in many cases such as yours, the parent directory, e.g.log/
will be the regex to use..gitignore
file change (not sure if push needed mind you, no harm if done).2) Remove the files from git (only).
git rm --cached some_dir/
3) Add and commit that change (essentially this is a change to “add” deleting stuff, despite the otherwise confusing “add” command!)
git add .
git commit -m"removal"