Created
September 24, 2020 15:19
-
-
Save iconifyit/4ae3f9f2a37ac0d8db480e5a042038eb to your computer and use it in GitHub Desktop.
Removes .DS_Store (Mac files) from a Git repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# .DS_Store files on Mac are meta files that tell Finder the window position and size of a previously opened folder. | |
# They are harmless but add clutter and useless code to your repos. This script removes them from your repo but not | |
# from your local file system. | |
# Remove .DS_Store from git | |
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch | |
# Add .DS_Store files to gitignore | |
echo .DS_Store >> .gitignore | |
# Commit to your repo | |
git add .gitignore | |
git commit -m '.DS_Store banished!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment