Skip to main content

Git Workflow Rules

Basics

Commit Messages

Issue Management

  • What to do with completed issues (close them, assign them back to someone — this varies by project, so ask beforehand)

Branch Management

All changes should be implemented in branches.

Branch Names

  • Branch names are all lowercase
  • Words are joined with -
  • Use names that describe what was done
  • The branch naming pattern is <change-type>/<change-description>.
    • Example: feature/task-one-gitignore-and-readme

Branching Strategy

The service development team primarily adopts a method based on GitFlow.

Feature Development / Regular Bug Fixes

  1. Create a feature/xxx branch from dev
  2. Make changes in feature/xxx and open a pull request to dev
  3. Merge after review

Production Release

  1. Open a pull request from dev to master
  2. Merge after review

Hotfix

  1. Create a hotfix/xxxx branch from master
  2. Open a pull request from hotfix/xxxx to dev
  3. Open a pull request from hotfix/xxxx to master
  • If using GitHub, making it a Draft pull request is a good idea
  1. Merge hotfix/xxxx into dev
  2. Merge hotfix/xxxx into master

Merging

  • When resolving conflicts, be careful not to lose any changes
  • In the case of merge commit conflicts, record the conflicted files in the merge commit message

gitignore

  • Auto-generated files, editor files, and OS files should be added to .gitignore and not tracked in the repository
  • Reference information

Default gitignore

$HOME/.config/git/ignore is the default ignore file, so run mkdir git under Users/hogehoge/.config and then vi ignore and enter the following to make things smoother. For reference, the following configuration excludes Terraform files and .DS_Store from Git tracking.

#  Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# .tfvars files
*.tfvars

# .DS_Store files
.DS_Store

Git Tips