본문 바로가기

Trouble Shooting

Git Attribute를 통한 특정 파일 merge 제외 (config 파일까지 merge되어 발생한 이슈, 1/9)

728x90

 

설정 방법

1. (소스별) develop, master 브랜치에 아래와 같이 .gitattributes 파일 생성  

파일명 merge=ours 형태로 작성

merge=ours의 의미 : merge가 되어도 각자 본인 브랜치에 작성된 파일을 유지한다

.gitattributes 작성 예시

 

 

2. (개인별) git config 설정

각자 git config 설정에 merge.ours.driver가 true를 추가해야 합니다. (1번에서 설정한 merge=ours 이 적용되기 위함)

git config --global merge.ours.driver true

설정이 잘 되었는지 확인하는 명령어

git config -l
위 명령어 결과로 아래와 같이 설정이 보인다면 성공
http.sslverify=false
merge.ours.driver=true
core.repositoryformatversion=0
core.filemode=false

 

[참고사이트]

 

Git - Git Attributes

디렉토리와 파일 단위로 다른 설정을 적용할 수도 있다. 이렇게 경로별로 설정하는 것을 Git Attribute 라고 부른다. 이 설정은 .gitattributes 라는 파일에 저장하고 아무 디렉토리에나 둘 수 있지만,

git-scm.com

 

 

git 레파지토리 서버별(prod/staging/testing 등) 설정파일 셋팅 방법. Git Attributes Merge 전략

저번에 heroku 에서 java spring boot 프로젝트를 올려서 서버를 하나 마련했는데, 운영환경과 동일한 테스트용도로 쓸 staging 서버를 하나 더 heroku 에 추가하려 했다. heroku는 Procfile 파일에 서버 실행

emflant.tistory.com

 

반응형