Forked from lohenyumnam/Add DS_Store into .gitignore for the sub directory.md
Created
June 9, 2023 14:48
-
-
Save faultyagatha/e75eb1126273cc4301deb39d84f95f4b to your computer and use it in GitHub Desktop.
Revisions
-
lohenyumnam revised this gist
Mar 23, 2018 . 1 changed file with 34 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,37 @@ If .DS_Store was never added to your git repository, simply add it to your .gitignore file. #### If you don't have one, create a file called ``` .gitignore ``` In your the root directory of your app and simply write ``` **/.DS_Store ``` In it. This will never allow the .DS_Store file to sneak in your git. #### if it's already there, write in your terminal: ``` find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch ``` then commit and push the changes to remove the .DS_Store from your remote repo: ``` git commit -m "Remove .DS_Store from everywhere" git push origin master ``` And now add .DS_Store to your .gitignore file, and then again commit and push with the 2 last pieces of code (git commit..., git push...) #### Other Solution If .DS_Store already committed: ``` find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch -
lohenyumnam created this gist
Mar 23, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ If .DS_Store already committed: ``` find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch ``` To ignore them in all repository: (sometimes it named ._.DS_Store) ``` echo ".DS_Store" >> ~/.gitignore_global echo "._.DS_Store" >> ~/.gitignore_global echo "**/.DS_Store" >> ~/.gitignore_global echo "**/._.DS_Store" >> ~/.gitignore_global git config --global core.excludesfile ~/.gitignore_global ```