.gitignore 파일이란?

Git에게 특정 파일이나 디렉토리를 추적하지 않도록 지시하는 역할을 하는 특수한 파일
해당 프로젝트와는 관계없는 파일들이 원격저장소에 올라가지 않도록 하기 위해 사용
민감한 정보를 포함하는 파일, 시스템이나 개발 도구에 의해 생성된 파일, 빌드 결과물 등을 Git의 추적 대상에서 제외할 수 있다.

.gitignore 파일의 각 줄은 무시할 패턴을 지정하며, 아래와 같은 규칙을 따릅니다:

  1. 빈 줄이나 #로 시작하는 줄은 무시됩니다.
  2. 표준 Glob 패턴을 사용합니다.
  3. 슬래시(/)로 시작하면 하위 디렉토리에 적용되지 않습니다.
  4. 디렉토리는 슬래시(/)를 끝에 사용하여 지정할 수 있습니다.
  5. 느낌표(!)로 시작하는 패턴의 파일은 무시되지 않습니다.

 

사용 예시:

스프링 부트 프로젝트에서 유출되면 안되는 중요한 정보가 담긴 파일이 GIt에 올라가지 않도록 설정

application.properties 파일 제거

# Application configuration
/src/main/resources/application.properties

 

자동 생성 사이트

https://www.toptal.com/developers/gitignore

깃허브 .gitignore파일을 편하게 만들기위한 오픈소스 프로젝트

결과물

# Created by https://www.toptal.com/developers/gitignore/api/java,windows,macos,intellij+all,visualstudiocode,gradle
# Edit at https://www.toptal.com/developers/gitignore?templates=java,windows,macos,intellij+all,visualstudiocode,gradle

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn.  Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.

.idea/*

!.idea/codeStyles
!.idea/runConfigurations

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

### Gradle ###
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

### Gradle Patch ###
# Java heap dump
*.hprof

# End of https://www.toptal.com/developers/gitignore/api/java,windows,macos,intellij+all,visualstudiocode,gradle

Branch 네이밍 규칙

1) master branch, develop branch

본래 이름을 그대로 사용한다. 

ex: master, develop

2) feature branch.

feature/{feature-name}  형식을 사용한다.

이때 feature-name은 소문자, 하이폰 (-)의 구성으로만 작성한다.

ex: feature/parameter-json-parser, feature/opencv-result-drawing

3) release branch

release/{version} 형식을 사용한다. 

ex: release/1.0

4) hotfix branch

hotfix/{version}, hotfix/{hotfix-name} 형식을 사용한다. 

ex: hotfix/1.0, hotfix/previous-restart-issue

 

Commit Message

💡 커밋 규칙

  • 최소 작업 단위를 기준으로 가능하면 작게 쪼갠다.
  • 1개의 커밋에는 1개의 행위만 들어 있게 한다.
  • 반드시 커밋구분 리스트를 접두사로 붙인다.
  • 한글로 읽는 사람이 이해하기 쉽도록 작성한다. 

커밋구분 리스트

커밋구분
설명
FEAT
(feature)개선 또는 기능 추가
BUG
(Bug Fix)버그 수정
DOC
(Documentation)문서 작업
TST
(Test)테스트 추가/수정
BLD
(Build)빌드 프로세스 관련 수정(yml)
PERF
(Performance)속도 개선
CLN
(Cleanup) 코드 정리 / 리팩토링
[출처] Git Commit Message|작성자 리차드

title

  • 커밋 구분 리스트를 접두사로 사용한다.
  • 그 후 ~한다는 명령어로 시작하여 한눈에 어떤 작업을 했는지 알기 쉽게 적는다.
  • 영어로 예시를 들면 Create~, Add~, Fix~, Delete~

summary

  • 45자 이내로 간결하게 작성한다.

description

  • summary를 풀어서 작성한다.
  • description만 보고도 어떤 작업을 했는지 파악할 수 있도록 작성한다.
  • 기존에서 변경된 사항이 있다면 before, after 를 명시한다.
  • ex) 함수 A 리턴값 타입 변경 : int → float

 

Pull Request

💡 PR 규칙

  • 최소 작업 단위를 기준으로 가능하면 작게 쪼갠다.
  • 1개의 PR에는 1개의 작업만 들어 있게 한다.
  • 코드의 변화를 300줄 미만으로 유지한다.
  • 리뷰어가 코딩 스타일을 리뷰하지 않도록 코드 컨벤션을 잘 지킨다.
  • 정상적으로 동작하는지 테스트하고, 정상적인 경우에만 PR 한다.
  • 한글로 읽는 사람이 이해하기 쉽도록 작성한다. 

title

  • 작업한 브랜치 명을 그대로 따라 간다. 

description

  • 작업 이유, 작업 내용, 리뷰어가 알아야 할 내용, 이미지 등을 상세하게 명시한다.

template

## 개요
작업하게 된 이유를 작성해주세요.

## 작업 내용
작업한 내용을 상세하게 설명해주세요.

### 추가된 사항
새로 추가한 작업에 대해 설명해주세요.

### 변경 사항
기존 내용에서 변경된 사항을 before -> after 형식으로 작성해주세요.

## 이슈
궁금한 사항 혹은 리뷰어들이 알아야 하는 이슈를 작성해주세요.

## 이미지
시각적인 설명이 필요한 경우 부가적으로 첨부해주세요.

https://blog.ull.im/engineering/2019/03/10/logs-on-git.html

 

ull.im

울려 퍼지다.<br/> 반향하다.<br/> 공명하다.

blog.ull.im

https://blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=skykbc&logNo=222016405016 

 

Git Commit Message

소스커밋시에 사용하는 메시지 규칙 여러 사람이 작업하면 정말 commit 메시지가 엉망이 됩니다 그걸 보기 ...

blog.naver.com

 

'Development > Git' 카테고리의 다른 글

AWS EC2 Route 53 배포시 도메인 연결하기 (gabia)  (0) 2023.08.12
.gitignore 파일  (0) 2023.07.27
Git branch 전략 (GitLab-Flow)  (0) 2023.07.24
Git branch 전략 (GitHub-Flow)  (1) 2023.07.23
Git branch 전략 (Git-Flow)  (1) 2023.07.23

+ Recent posts