Along with ignoring the folder, you need to git rm
it. Git only ignores files that aren't already under its control.
Be aware, though: doing so will cause git to remove that folder for anyone else who pulls those changes. You'd better be sure that folder is just the output from building, or can otherwise be easily reconstructed.
If you haven't published the changes yet (that is, if you've never pushed them to anywhere and no one's pulled them from you), then you have the option of rewriting the history. You can simply say git reset --soft the_commit_before_you_added_bin
(of course, you'll need the actual commit ID, or another name for it, like HEAD~3
etc) to basically "uncommit" to right before you added it. Your working copy will still have the latest versions of the files, but Git will all but forget you committed them. (This also means you lose intermediate changes.) You can then redo your commit(s), being careful to avoid bin
this time.
Git has a filter-branch
command that can allegedly help with automating all that, and can even preserve intermediate changes. I've never used it, though, and couldn't tell you how to use it.
Obligatory Big Bold Warning:
Don't rewrite history that has already been published.
Only undo/rewrite commits that have never been pushed or pulled. Otherwise, wackiness ensues.