Tools

การลบ .DS_Store files ใน Git repository

ถ้าหากใครใช้ Git บน macOS อาจจะมีปัญหาเวลา commit Project ขึ้น Git ไปแล้ว แต่ลืม ignore .DS_Store file ซึ่งในบทความนี้ก็จะแนะนำวิธีการแก้ไขง่ายๆ เพียงไม่กี่บรรทัด

02 พฤษภาคม 20211 นาที
0
การลบ .DS_Store files ใน Git repository
Table of Contents

Find .DS_Store

หาไฟล์ .DS_Store และทำการลบมันทิ้งซะ

Bash Logo
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

add .DS_Store

เพิ่ม .DS_Store เข้าไปในไฟล์ .gitignore

Bash Logo
echo .DS_Store >> .gitignore

Commit

ขั้นตอนสุดท้าย Commit เข้า Repo ก็เป็นอันเสร็จเรียบร้อย

Bash Logo
git add .gitignore git commit -m '.DS_Store banished!' git push origin (branch)

Source

Tags:Git

คลิกเพื่อแสดงความคิดเห็น