[How To] gitignore μ€μ λ°©λ²
Updated:
π₯ gitignore μ€μ λ°©λ²
μ΄μ¬ν μλ° νλ‘μ νΈλ₯Ό νλ€.. κΉνλΈμ 컀λ°μ νκ³ λ³΄λ λ νμ§ν 리μ μ΄μν νμΌμ΄ λμ§λμ§ λΆμ΄μλ κ²½μ°κ° μλ€.
νΉν Mac κ°μ κ²½μ°λ .DS_Store νμΌ κΉμ§ κ°μ΄ 컀λ°λμ΄ κ΅μ₯ν 보기 λλ½κ³ λΆνΈνκ³ μ κ²½μ°μΈλ€.
μ΄λ .gitignore μ μ¬μ©νλ©΄ λ΄κ° μνλ νμΌλ§ μ»€λ° ν μ μλ€.

μ°μ μ»€λ° ν λ νμ§ν 리μ λ€μ΄κ° .git μ μμ±νλλ‘ νλ€.
κ·Έ λ€μ .gitignore μ μμ±νλ€. νμΌ λͺ μμ .μ΄ λΆμ΄μμΌλ©΄ μ¨κΉνμΌμ΄ λλ―λ‘ $ ls -a λ₯Ό ν΅ν΄ μ μμ±λμλ νμΈνμ.
μμ±μ΄ λμλ€λ©΄ $ vi .gitignore μ ν΅ν΄ .gitignore νμΌμ νΈμ§νμ.
μ΄λ μ»€λ° νμ§ μμ νμΌμ μ νλ μ¬λ¬κ°μ§ κ·μΉμ΄ μλλ° μ΄κ³³ μ μ μνλ©΄ λ΄κ° μνλ κ·μΉμ μμ± ν΄ μ€λ€.
νΉμ νμ₯μλ‘ λλλ νμΌμ μ μΈνκ³ μΆλ€λ©΄ *.νμ₯μ λλ ν 리λ₯Ό μ μΈνκ³ μΆλ€λ©΄ λλ ν 리λͺ / μ λ£μ΄μ£Όλ©΄ λλ€.

λ κ°μ κ²½μ°λ λ§₯, μ΄ν΄λ¦½μ€, μλ° λ₯Ό ν΅ν΄ λ§λ νλ‘μ νΈλ₯Ό μ»€λ° ν κ²μ΄κΈ° λλ¬Έμ μ λ κ² μ€μ μ ν΄μ€λ€.
μμ±μ λλ₯΄λ©΄ λμ€λ κ²°κ³Όλ₯Ό .gitignore μ κ·Έλλ‘ λ³΅μ¬ λΆμ¬λ£κΈ° νλ©΄ λλ€.
κ·Έλ¦¬κ³ remote μ€μ μ ν΄μ€ λ€ push λ₯Ό νκ² λλ©΄ κΉλνκ² μνλ νμΌλ§ μ»€λ° ν μ μλ€.

π₯ gitignore μ λ³κ²½νκ³ μΆμ κ²½μ°
μ μ¬μ§μ 보면 .classpath, .project νμΌμ΄ μ»€λ° λμ΄ μλ€.
μλ§ μ΄κ³³ μμ λ§λ€μ΄μ€ μ½λμ .classpath, .project λ μμλ보λ€.
μ΄λλ λ¨Όμ λ νμ§ν 리μ μΊμλ₯Ό $ git rm -r βcached . μ ν΅ν΄ λͺ¨λ μμ ν΄μ€λ€.

κ·Έλ¦¬κ³ $ vi .gitignore μ ν΅ν΄ .classpath .project λ₯Ό μΆκ°ν΄μ€ λ€ μ μ₯νλ€.
μ΄μ $ git add . λ₯Ό νκ³ μ»€λ°μ ν΄μ£Όλ©΄ μ μΈ λ κ²μ λ³Ό μ μλ€.

Leave a comment