Sébastien
Sébastien

Reputation: 5453

How to remove distant folders added to .gitignore

I have added a folder (which was previously synchronized) to my .gitignore file.

Fine. Now when I make a git add -A, git commit -m "ok", git push, I still see this folder in my distant rep.

I'd like that folder to be completely ignored and not appear in my distant rep. Can I remove it from those distant rep ?

Upvotes: 1

Views: 79

Answers (1)

VonC
VonC

Reputation: 1325137

You need to record the deletion of that folder in your repo first, and push that deletion to your distant repo:

(The --cached option of git rm allows you to remove an element from the Git index without deleting it from the working tree on the disk itself)

git rm --cached -r yourFolder
git commit -m "remove folder"
git push

Then:

  • the .gitignore will ignore that folder
  • the distant repo won't show the folder anymore.

Upvotes: 1

Related Questions