PositiveGuy PositiveGuy - 3 years ago 201
Git Question

Delete specific files by extension locally then push Deletes to Remote

I just pushed a bunch of stupid sourcemap files with extension

to my remote repo with a push.

I want to remove those map files and there are a bunch of them.

What's the best way to do this? I forgot to add .map to my gitignore, well that's there now but now I need to go back and delete the files both locally and in the remote.

Answer Source

If you are on a unix-like system (Linux or MacOS), you can use the find command, like so:

find . -type f -name "*.map" | xargs git rm

This will delete all the map files and stage the deletions for a commit.

You can then go ahead and do a git commit and a git push.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download