Accidently pushed files to remote

I mistakenly added many .png files (all from 1 directory) to my local git index then pushed them to the remote github.
Afterwards, I removed (rm) them from the local --cache and synced this change with the remote/github
At this point - when looking at origin.master (on github) the .png files appear to have been removed

However, on github, when I navigate (history) I can still see the dir and all of the .png files, they appear to still be on github.

My question is . . . on github - it seems these .png files are still there and (using storage space on github)?? If yes, how do I remove these .png files using git bash command(s)?

You would have to rewrite the history of the repo. You can do that with a git filter branch but it is much easier using a tool like BFG


The only reason the png files are an issue to me is because they (are now untracked) yet still using storage space on GitHub. Perhaps a mistake like this (accidentally pushing files that should .getignored to GitHub) is somewhat common and the majority of folks who do this simply leave the historical files files on GitHub under the mindset of (I have plenty of storage space)

Perhaps I can ask a slightly different question - what would be the easiest way to remove these png files from the remote/GitHub? When I try to use the GitHub’s UI it won’t let me delete them stating (you must be on a branch to make or proposed changes)

I still believe BFG is your best option.

:wave: Welcome!

Because git serves to preserve the history of your work in a repository, it is expected behaviour that files that you have removed from the current version of your repository remain in its history.

In situations like this though, that can be a pain.

Our official documentation is here:

But as @kingthorin suggests, BFG is probably your best move.