개발자 jin K

[Git] git ignore 특정 파일 또는 폴더 제외 or 무시하기 본문

기타

[Git] git ignore 특정 파일 또는 폴더 제외 or 무시하기

jin K 2021. 6. 17. 16:42

 

* 염두에 둘 것

- commit 된 파일은 안됨 : 기존 git의 관리를 받고 있던 것들 (commit된 것들) 의 파일이나 폴더를 .gitignore 파일에 작성하고 add > commit > push 하여도 ignore(무시) 되지 않습니다.

- (경험상) 이미 깃에 staging 된 파일일 경우 프로젝트 새로 받아오는게 빠를 수 있음

 

 

* git ignore 특정 파일 또는 폴더 제외 or 무시하기

 

기존에 가지고 있는 cached를 지워야 한다. 명령어는 다음과 같다.

## 파일
git rm --cached test.txt

## 전체파일
git rm --cached *.txt

## 폴더
git rm --cached test/ -r

 

* gitignore 파일 작성하기

 

https://www.toptal.com/developers/gitignore

 

gitignore.io

Create useful .gitignore files for your project

www.toptal.com

 

위 사이트에서 해당 언어나 설정을 체크하고 나온 결과물을 본인의 프로젝트 파일에 붙여 넣어준다.

 

 

 

 

참조 : https://kcmschool.com/194 [web sprit]