상세 컨텐츠

본문 제목

[Git] Commit tamplate file

Operating System (OS) & Network & VCS/Git

by 찌니씨 2022. 10. 12. 10:33

본문


커밋 템플릿 파일 만들기
(commit tamplate file)

 

파일을 만들기에 앞서!

리눅스 환경에서 파일, 디렉터리를 생성하는 방법을 알아보자

 

파일과 디렉토리 생성, 삭제 관련 기본 LINUX 명령어

 

$ vi file_name // 파일 생성 (해당 file명이 없을 시 file이 생성된다)

$ rm -rf file_name //파일 삭제 (묻지 않음)

$ mkdir directory_name // 디렉토리 생성
$ mkdir -p directory_name/file_name // 디렉토리/파일 (상위 디렉토리 없을 시 상위 디렉토리 생성)

$ rmdir directory_name //디렉토리 삭제

 

✔ 파일과 디렉토리 생성, 삭제 관련 그 외 LINUX 명령어

 

$ touch file_name //없는 파일명을 입력 시 빈파일, 혹은 해당 파일의 수정시간을 변경

 

 

touch

 

$ cat>file_name //파일생성과 함께 편집모드 실행 입력 완료 후 ESC + :wq! 입력 (저장하고 편집모드 빠져나오기)

 

cat
cat_편집모드

 

그럼 이제~

 

적용할 git 프로젝트로 이동

.gitmessge.txt 생성

(위의 방법 중 골라서 생성하여 보자)

 

$ cat>.gitmessage.txt //gitmessage.txt 파일 생성과 함께 편집모드(vi) 실행

 

아래를 그대로 사용하거나 입맛 해도 수정하고  ESC + :wq! (저장하고 편집 모드 빠져나오기)

 

Subject: (Short Description)
Type: (Type of change)
####################################
Opened or Closed issues (Tickets)

# Scopte of this change
# Breaking changes
# Description: (Long description)
####################################
#
# Type of change
#
#	feature - A new feature
#	fix - A bug fix
#	docs - Documentation only changes
#	style - Changes that do not affect the meaning of the code
#	refactor - A code change that neither fixes a bug nor adds a feature
#	perf - A code change that improves performance
#	test - Adding missing tests or corrcting existing tests
#	build - Changes that affect the build system or extenal dependencies
####################################

".git/COMMIT_EDITMSG" 14L, 297C

 

.itmessage.txt 파일 생성, 저장 후 아래의 명령어 입력

$ git config --global commit.template ~/.gitmessage.txt file_path //file_path 생략가능
$ git commit

 

커밋할 때 아래와 같은 메시지를 편집기에 자동으로 채워준다.

 

tamplate

 

Git Config 설정

 

//git config 설정 목록보기
$ git config -l
$ git config --list  // -l의 full 명령어

branch.release/release-0.1.remote=origin
branch.release/release-0.1.merge=refs/heads/release/release-0.1
branch.hotfix/hotfix-0.1.remote=origin
branch.hotfix/hotfix-0.1.merge=refs/heads/hotfix/hotfix-0.1
branch.support/support-0.1.remote=origin
branch.support/support-0.1.merge=refs/heads/support/support-0.1
branch.feature/jini-v0.2.remote=origin
branch.feature/jini-v0.2.merge=refs/heads/feature/jini-v0.2
credential.helper=store
branch.feature/jini-v0.1.remote=origin
branch.feature/jini-v0.1.merge=refs/heads/feature/jini-v0.1

 

Git Config 설정 해제

 

//local 설정한 config_name 취소
$ git config --unset config_name 

$ git config --unset user.name
$ git config --unset user.email

$ git config --unset commit.template //commit.template 취소
$ git config --unset-all commit.template //commit.template이 여러개일 경우

//global 설정한 config_name 취소
$ git config --unset --global config_name 

$ git config --unset --global user.name
$ git config --unset --global user.email

$ git config --unset --global commit.template //commit.template 취소
$ git config --unset-all --global commit.template //commit.template이 여러개일 경우

 

 

참고

https://www.git-scm.com/book/ko/v2/Git%EB%A7%9E%EC%B6%A4-Git-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0

 

Git - Git 설정하기

8.1 Git맞춤 - Git 설정하기 지금까지 Git이 어떻게 동작하고 Git을 어떻게 사용하는지 설명했다. 이제 Git을 좀 더 쉽고 편하게 사용할 수 있도록 도와주는 도구를 살펴본다. 이 장에서는 먼저 많이

www.git-scm.com

https://git-scm.com/docs/pretty-formats

 

Git - pretty-formats Documentation

If the commit is a merge, and if the pretty-format is not oneline, email or raw, an additional line is inserted before the Author: line. This line begins with "Merge: " and the hashes of ancestral commits are printed, separated by spaces. Note that the lis

git-scm.com

 

https://meetup.toast.com/posts/106

 

좋은 git 커밋 메시지를 작성하기 위한 7가지 약속 : NHN Cloud Meetup

git커밋

meetup.toast.com

 

'Operating System (OS) & Network & VCS > Git' 카테고리의 다른 글

[Git] Git이란?  (0) 2022.10.14
[Git] mergetool  (0) 2022.10.12
[Git] Cherry-pick  (0) 2022.10.11
[Git] Merge 되돌리기  (0) 2022.10.11
[Git] Flow 수정, 초기화  (0) 2022.10.07

관련글 더보기

댓글 영역