An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
.gitignore all .DS_Store files, even if already committed
Hello everyone, and welcome to #10stips! The column where you learn how to solve coding issues within 10 seconds.
In today's episode I show you how to .gitignore MacOS .DS_Store files in every folder and subfolder of your project.
A little bit of background
I recently jumped onboard onto an existing Rails 4 project.
Yes, Rails 4 is still widely used in production and oftentimes is particularly challenging to upgrade an application with newer Rails versions without creating breaking changes.
As soon as I cloned the repository, and opened up the code with Atom, I noticed all those magical .DS_Store files.
"Fuck! Back up little bastards!"
How to .gitignore .DS_Store files
First, unmatch previously committed files:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
Then, add **/.DS_Store
into .gitignore
Finally, commit and push the changes:
git commit -m "Remove .DS_Store from everywhere"git push
You're welcome!
Now, your Mac will still create .DS_Store files in every folder. If you become frustrated, you can turn them off.
(bonus) How to turn off the creation of .DS_Store files
Mac creates the .DS_Store files to retain settings configured for each folder such as the size and orientation of icons, sort settings, and so on.
If you become frustrated, you can turn off the creation of .DS_Store files - just execute the following command in Terminal:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
Reboot your Mac, and youll be good to go.
Original Link: https://dev.to/mattiadev/gitignore-mac-dsstore-files-even-if-already-committed-14dm
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To