shader
shader

Reputation: 71

File removed using git rm --cached, but git still pushes it to my repo?

I have removed my file using git rm --cached and git reset HEAD. But when I try to push it to my repo, it still adds that file? How can I completely remove that file?

Upvotes: 2

Views: 2499

Answers (3)

tehp
tehp

Reputation: 6384

For anyone seeing this question in the future,

Remember you must remove the files and then commit with the .gitignore present for the .gitignore to actually ignore the files.

Not deleting the files manually will result in the existing files staying in the repo, but new files that are added will be ignored.

Upvotes: 2

Vishnu Ranganathan
Vishnu Ranganathan

Reputation: 1355

git rm <filename> will keep track of your file that you are deleting a file which is there in git repo and keeps track yes the behavior is right.

for you, you need to remove it normally rm -rf will delete the file now . now do git status and don't add the deleted file then commit and push it . it will work as how you are expecting.

Upvotes: 0

shader
shader

Reputation: 71

It's my bad. I wasn't using git commit after git rm -- cached.

Upvotes: 0

Related Questions