본문 바로가기

Study

[Git/Github] Git에게 맡기지 않을 것들

더보기

본 글은 유튜브를 참고해 개인적으로 정리한 글입니다.

 

https://youtu.be/1I3hMwQU6GU

 

굳이 포함할 필요가 없거나 보안상의 문제로 포함하지 말아야할때 Git의 관리에서 특정 파일/폴더를 배제한다.

 

.gitignore 파일을 사용해서 배제할 요소들을 지정할 수 있다.

 

중요한 문서를 만들고 

git status 명령어를 입력하면

이렇게 뜨는 것을 확인할 수 있는데

 

이때 .gitignore 파일을 생성하고 내용에 배제할 파일.확장자명 을 입력 후 저장하면

더이상 뜨지 않는 걸 확인 할 수 있다.

 

자세한것은 여기서 알아볼 수 있다.

https://git-scm.com/docs/gitignore

 

Git - gitignore Documentation

The optional configuration variable core.excludesFile indicates a path to a file containing patterns of file names to exclude, similar to $GIT_DIR/info/exclude. Patterns in the exclude file are used in addition to those in $GIT_DIR/info/exclude.

git-scm.com

더보기
# 이렇게 #를 사용해서 주석

# 모든 file.c
file.c

# 최상위 폴더의 file.c
/file.c

# 모든 .c 확장자 파일
*.c

# .c 확장자지만 무시하지 않을 파일
!not_ignore_this.c

# logs란 이름의 파일 또는 폴더와 그 내용들
logs

# logs란 이름의 폴더와 그 내용들
logs/

# logs 폴더 바로 안의 debug.log와 .c 파일들
logs/debug.log
logs/*.c

# logs 폴더 바로 안, 또는 그 안의 다른 폴더(들) 안의 debug.log
logs/**/debug.log