능히 할수있다!

[Git/GitHub]'git init' 입력 시 branch관련 hint가 출력되는 현상 본문

STUDY/Git, GitHub

[Git/GitHub]'git init' 입력 시 branch관련 hint가 출력되는 현상

능히버섯와나 2023. 6. 5.

🚧 오류 내용

  - 생활코딩 지옥에서 온 Git 진행 중 터미널에 'git init'을 입력하니 아래와 같은 hint가 출력되었다.

hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>

 

 

 🔎 분석

  - 기본 Branch 이름을 'master'로 지정하나, 원하는 명칭이 있으면 아래의 코드를 이용하여
     'main', 'trunk'등 원하는 이름으로 변경하라고 하는 것으로 확인된다.

git config --global init.defaultBranch <name>

 

 

 🪄 문제 해결

  - 'git init'을 다시 입력해보니 hint가 재출력 되지는 않았지만 위 코드를 이용하여 'main'으로 명칭을 변경해주었다

    아래의 코드를 입력하여 defaultBranch를 확인해보니 'main'으로 바뀌었다는 것을 확인할 수 있었다.

git config init.defaultBranch

 

Comments