Git의 루트 폴더에서 파일만 제외하는 방법
을 사용하는 것을 알고 있습니다..gitignore추가 중인 일부 파일을 제외하는 파일이지만 여러 개가 있습니다.config.php소스 트리에 있는 파일을 제외하고 루트에 위치한 하나만 제외하고 다른 하나는 수정본 제어 하에 있어야 합니다.
내가 적어야 할 것.gitignore이 일을 성사시키기 위해?
설명서에서 다음을 참조하십시오.
패턴에 슬래시 /가 포함되지 않으면 git는 이 패턴을 셸 글로브 패턴으로 처리하고 .gitignore 파일의 위치(.gitignore 파일이 아닌 경우 작업 트리의 최상위 수준을 기준으로 함)에 대한 경로 이름과 일치하는지 확인합니다.
선행 슬래시는 경로 이름의 시작 부분과 일치합니다.예를 들어 "/*.c"는 "cat-file.c"와 일치하지만 "mozilla-sha1/sha1.c"는 일치하지 않습니다.
따라서 루트에 다음 행을 추가해야 합니다..gitignore:
/config.php
사용하다/config.php.
이전 버전의 Git에서는 먼저 무시 패턴을 정의하고 다음 행에서 즉시 제외를 정의해야 합니다.[버전 1.9.3(Apple Git-50)에서 테스트됨]
/config.php
!/*/config.php
이후 버전에서는 다음 [버전 2.2.1에서 테스트됨]만 필요합니다.
/config.php
위의 해결책이 효과가 없으면 다음을 시도해 보십시오.
#1.1 Do NOT ignore file pattern in any subdirectory
!*/config.php
#1.2 ...only ignore it in the current directory
/config.php
##########################
# 2.1 Ignore file pattern everywhere
config.php
# 2.2 ...but NOT in the current directory
!/config.php
워드프레스 사이트의 예이지만, 기본적으로 모든 것을 무시하고!로 시작하는 예외를 포함할 내용에 대해 추가합니다.
# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/
!wp-config.php
#
# # Ignore everything in the "wp-content" directory, except the "plugins"
# # and "themes" directories.
wp-content/*
!wp-content/plugins/
!wp-content/themes/
#
# # Ignore everything in the "plugins" directory, except the plugins you
# # specify (see the commented-out examples for hints on how to do this.)
wp-content/plugins/*
# # !wp-content/plugins/my-single-file-plugin.php
# # !wp-content/plugins/my-directory-plugin/
#
# # Ignore everything in the "themes" directory, except the themes you
# # specify (see the commented-out example for a hint on how to do this.)
wp-content/themes/*
!wp-content/themes/twentyeleven/
언급URL : https://stackoverflow.com/questions/3637660/how-to-exclude-file-only-from-root-folder-in-git
'prosource' 카테고리의 다른 글
| 프로그래밍 방식으로 테이블 보기 행 선택 (0) | 2023.05.03 |
|---|---|
| 아이덴티티를 바꾸는 방법_SQL Server 2008을 사용하여 INSERT On/Off? (0) | 2023.05.03 |
| CTRL-r과 유사하게 검색 Bash 기록을 전달할 수 없습니다. (0) | 2023.05.03 |
| 파이프 오류: Microsoft Visual C++ 14.0이 필요합니다. (0) | 2023.05.03 |
| list Postgres ENUM 유형 (0) | 2023.05.03 |