Skip to content

Instantly share code, notes, and snippets.

@DronRathore
Last active November 3, 2015 17:20
Show Gist options
  • Save DronRathore/fa3f705d28755455e039 to your computer and use it in GitHub Desktop.
Save DronRathore/fa3f705d28755455e039 to your computer and use it in GitHub Desktop.
Removes .DS_STORE and underscore files from any folder
#!/bin/bash
# Browsing directories on mac creates .DS_STORE and further
# it create similar files for any file you open
# it is annoying to see such files in a github repo folder and often
# we end up pushing them in our codebase
# so here is a one liner solution to remove .DS_STORE and other ._files from git
# run junk for non git repo, or cg for git repo, you can add this in your .bash_profile too.
# Add the below lines in your .bash_profile, run source ~/.bash_profile and done
alias junk='find ./ -maxdepth 30 -name "._*" -delete'
# cg = clean git
alias cg="junk && git status | grep "deleted: *" | awk '{print $3}' | xargs git rm"
# Peace Brother
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment