1

I need help with removing files from GIT, which was pushed to Bitbucket and now I need to remove them.

Detailed explanation

I created project and git push origin master full folder. But after 2 weeks I did some changes and now I want to remove image folder from repository (where are stored images from users). So I added path to .gitignore file (/public/images/). Then push changes to Bitbucket. But problem is, that on Bitbucket repository is still folder /public/images/ and when I deploy on production, there is /public/images/ folder in each version. So I need to delete it from Bitbucket repository, and I don't know how. I thought when I add ignore line in GIT, then it will be automaticaly destroyed from repository.

Anubix
  • 119
  • 1
  • 11
  • 1
    It's unclear what you're asking.. – Maroun Oct 22 '15 at 14:21
  • Possible duplicate of [Is there a simple way to remove unwanted file from Github history?](http://stackoverflow.com/questions/27761031/is-there-a-simple-way-to-remove-unwanted-file-from-github-history) The solution would be the same for BitBucket as Github. You want to remove files that were committed and instead should be ignored. – Schleis Oct 22 '15 at 14:24
  • I added detailed explanation. Pls look on it. – Anubix Oct 22 '15 at 15:58

1 Answers1

4

If I understood the question you want to remove a folder so that it no longer appears in the latest commit.

.gitignore only cause git to ignore files it isn't already tracking. To remove something you need git rm.

Something like git rm -r /public/images should stage the removal of the folder which can then be committed and pushed as you would any other change.

Holloway
  • 6,412
  • 1
  • 26
  • 33