1

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 ?

Sébastien
  • 5,263
  • 11
  • 55
  • 116
  • please see this answer http://stackoverflow.com/questions/492558/removing-multiple-files-from-a-git-repo-that-have-already-been-deleted-from-disk – Yazan Rawashdeh Mar 29 '15 at 13:34

1 Answers1

1

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.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • nice, it's working well. note, i just had to skip the git add -A which would cancel the previous line effect – Sébastien Mar 29 '15 at 18:12
  • 1
    @SébastienVassaux right: `git rm` modifies the index directly, no `git add` necessary. I have removed it from the answer. – VonC Mar 29 '15 at 19:25