본문 바로가기
Other

[Github] 파일/폴더명의 대소문자를 구분하지 않는 문제

by 푸고배 2022. 12. 10.

ISSUE

Github 연동이 되어있는 프로젝트에서 파일명이나 폴더명의 대소문자를 수정하는 경우가 있다.

(예를 들어 컴포넌트 이름을 header.vue -> Header.vue로 수정하는 경우)

이때 git status를 확인해보면 대소문자 변경이 제대로 적용되지 않은 것을 확인 할 수 있는데,

해결방법은 아래와 같이 두 가지가 있다.

해결방법

gif mv 이용 : 파일의 경우

git mv yOuRfIlEnAmE yourfilename
or
git mv -f yOuRfIlEnAmE yourfilename

git 2.0.1 이하의 버전에서는 -f 플래그가 필요하다.

git config 변경

git에는 대소문자를 구분할지 구분하지 않는 파일 시스템을 예상할지 여부를 알려주는 구성 설정이 있다.

파일이 아닌 폴더의 경우는 이 방법을 이용하고는 한다.

git config core.ignorecase false

다만, 대소문자를 구분하지 않는 파일 시스템(윈도우, OS X 등)에서 이 옵션을 false로 설정하는 것은 일반적으로 좋지 않다고 한다. 

이 방법을 사용하면 간혹 git이 가짜 충돌을 보고하거나 중복 파일을 생성하는 문제가 발생한다.

Reference

 

How do I commit case-sensitive only filename changes in Git?

I have changed a few files name by de-capitalize the first letter, as in Name.jpg to name.jpg. Git does not recognize this changes and I had to delete the files and upload them again. Is there a way

stackoverflow.com

 

Git - git-mv Documentation

Each time a superproject update moves a populated submodule (e.g. when switching between commits before and after the move) a stale submodule checkout will remain in the old location and an empty directory will appear in the new location. To populate the s

git-scm.com

 

반응형

댓글