Git Workflow Rules
Basics
Commit Messages
- Write in English
- Changed filenames are visible in the commit, so they are not needed in the message
- Describe what was changed
- It is also good to define prefix rules for your project
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
- Create a
feature/xxxbranch fromdev - Make changes in
feature/xxxand open a pull request todev - Merge after review
Production Release
- Open a pull request from
devtomaster - Merge after review
Hotfix
- Create a
hotfix/xxxxbranch frommaster - Open a pull request from
hotfix/xxxxtodev - Open a pull request from
hotfix/xxxxtomaster
- If using GitHub, making it a Draft pull request is a good idea
- Merge
hotfix/xxxxintodev - Merge
hotfix/xxxxintomaster
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
- .gitignore files can be automatically generated at gitignore.io
- Language-specific
.gitignorerepository: github/gitignore
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
- Luke, please don't use git push --force... Use git push --force-with-lease instead...
- Even when you absolutely need
git push --force, consider whether you can usegit push --force-with-leaseinstead
- Even when you absolutely need