so you can separate one commit from another, succinctly
Overview
Here are suggestions to make Git commit messages more useful and convenient.
NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.
-
The same message can be associated with all commits added before a commit. So before doing a git commit, check what changes have been added already:
git status
Modified:
in the response identify items added for the next commit. -
Specify a commit message when you provide a command such as:
git commit -m"#BUG342 NEW: initial commit README.md"
REMEMBER: If you issue a “git commit” without the “-m” which provides the commit message, Git presents you a text editor window to type in a long message. (And if you see a “:” at the lower-right corner, type
wq!
to exit.)PROTIP: Specify an alias to type the minimal number of keystrokes, such as:
gas "#BUG342 NEW: initial commit README.md"
-
If you are using a planning system, type the identifier for it (such as “#BUG342”) in order to link code changes back to plans. Examples of planning systems:
- Jira
- https://github.com/marketplace/testquality
-
Begin with a capital letter.
-
Specify the status action in all capital (upper-case) letters, such as “NEW”, “REMOVE”, “RENAME”, “DOC”, “UPDATE”, “IMPROVE”, “FIX”, “RELEASE”.
https://github.com/ahmadawais/Emoji-Log for examples.
-
Use imperative present-tense action verbs like you’re giving an order: “add”, “create”, “update”, “revise”, “renumber”, “delete”, etc.
PROTIP: Don’t use past-tense verbs or gerunds such as “added” or “updating”. This is because commits can be in several states over time.
-
Alternatively, add emojis (listed below) to tag messages instead of typing a common purpose, intent, or other metadata about a commit. Emoji graphic icons can be recognized at a glance, no matter the spoken language.
Insert Emojis icons are created by Git when it recognizes specific keywords between colons.
PROTIP: Writing :shipit: in a message will cause :shipit: inserted and also triggers progression of the commit to the next stage in some CI/CD pipelines.
Also, Emoji graphic icons take a single character in place of perhaps several words.
-
Limit the message to 50 characters.
-
Don’t end the line with a period. That’s unnecessary.
The above are based on: Angular Git commit message guidelines – well known and proven Git commit message convention which was introduced by the Angular project (A.K.A. Google).
Emojis
You don’t have to use them. Or you can use a small subset of them. But in case others use them, to help to find their meaning, I’ve listed all emojis below. These are from Carlos Cuesta’s visual page and CLI. I’ve classified them below in a more concise way:
Status / Warnings :
🎉 :tada: = Initial (NEW) commit.
🚧 :construction: = Work in progress.
🚑 :ambulance: = Critical hotfix.
✨ :sparkles: = Introducing new features.
🍻 :beers: = Writing code drunkenly.
💩 :hankey: = Writing bad code that needs to be improved.
🚨 :rotating_light: = Removing linter warnings.
⏪ :rewind: = Reverting changes.
⚗ :alembic: = Experimenting new things
🔒 :lock: = Fixing security issues.
⚡️ :zap: = Improving performance.
🚸 :children_crossing: = Improving user experience / usability.
🐛 :bug: = Fixing a bug.
Documentation:
📝 :memo: = Writing docs
💡 :bulb: = Documenting source code
🔍 :mag: = Improving SEO
👥 :busts_in_silhouette: = Adding contributor(s)
📖 :book: = Issue
Testing:
✅ :white_check_mark: = Updating tests.
👌 :ok_hand: = Updating code due to code review changes.
🤡 :clown_face: = Mocking things.
Dependency management:
💥 :boom: = Introducing breaking changes.
⬇️ :arrow_down: = Downgrading dependencies.
⬆️ :arrow_up: = Upgrading dependencies.
📌 :pushpin: = Pinning dependencies to specific versions.
➕:heavy_plus_sign: = Adding a dependency.
➖ :heavy_minus_sign: = Removing a dependency.
Coding Content:
🏗 :building_construction: = Making architectural changes.
🔥 :fire: = Removing code or files.
✏️ :pencil2: = Fixing typos.
🔊 :loud_sound: = Adding logs.
🔇 :mute: = Removing logs.
🎨 :art: = Improving structure / format of the code.
♻️ :recycle: = Refactoring code logic.
👷 :construction_worker: = Adding CI build system.
🚀 :rocket: = Deploying stuff.
🔖 :bookmark: = Releasing / Version tags.
💬 :speech_balloon: = Updating text and literals.
📈 :chart_with_upwards_trend: = Adding analytics or tracking code.
☸️ :wheel_of_dharma: = Work about Kubernetes
🌐 :globe_with_meridians: = Internationalization and localization.
🥚 :egg: = Adding an easter egg.
🏷️ :label: = Adding or updating types (Flow, TypeScript)
🗃 :card_file_box: = Performing database related changes.
♿️ :wheelchair: = Improving accessibility.
💄 :lipstick: = Updating the UI and style files.
Configuration / Metadata:
🐳 :whale: = Work about Docker.
💚 :green_heart: = Fixing CI Build.
🔧 :wrench: = Changing configuration files.
🔀 :twisted_rightwards_arrows: = Merging branches.
📦 :package: = Updating compiled files or packages.
👽 :alien: = Updating code due to external API changes.
🚚 :truck: = Moving or renaming files.
📄 :page_facing_up: = Adding or updating license.
🍱 :bento: = Adding or updating assets.
🙈 :see_no_evil: = Adding or updating a .gitignore file
📸 :camera_flash: = Adding or updating snapshots
📱 :iphone: = Working on responsive design.
Operating system specific:
🍏 :green_apple: = Fixing something on iOS.
🍎 :apple: = Fixing something on macOS.
🐧 :penguin: = Fixing something on Linux.
🏁 :checkered_flag: = Fixing something on Windows.
🤖 :robot: = Fixing something on Android.
The whole list of emojis are listed (without meanings) in this cheatsheet.
Emojis
This video shows how to using Visual Studio for Mac to create a ASP.NET Core Lazer pages web site that displays emojis retrieved using the GitHub API.
Automated compliance
https://opensource.com/article/19/2/emoji-log-git-commit-messages
Emoji Git commit message convention – I’m not kidding,
https://github.com/marketplace/todo is a GitHub app that creates new issues based on actionable comments in your code. It is built with Probot.
Resources
https://datree.io/blog/git-commit-message-conventions-for-readable-git-log/?source=dev.to
Datree Datree connects with GitHub pull requests to provide automatic policy compliance checks and insights for every code change. Create and enforce custom or built-in policies, in the context of your dev stack.
@datreeio datree.io
More on DevOps
This is one of a series on DevOps:
- DevOps_2.0
- ci-cd (Continuous Integration and Continuous Delivery)
- User Stories for DevOps
- Git and GitHub vs File Archival
- Git Commands and Statuses
- Git Commit, Tag, Push
- Git Utilities
- Data Security GitHub
- GitHub API
- Choices for DevOps Technologies
- Pulumi Infrastructure as Code (IaC)
- Java DevOps Workflow
- AWS DevOps (CodeCommit, CodePipeline, CodeDeploy)
- AWS server deployment options
- Cloud services comparisons (across vendors)
- Cloud regions (across vendors)
- Azure Cloud Onramp (Subscriptions, Portal GUI, CLI)
- Azure Certifications
- Azure Cloud Powershell
- Bash Windows using Microsoft’s WSL (Windows Subsystem for Linux)
- Azure Networking
- Azure Storage
- Azure Compute
- Digital Ocean
- Packer automation to build Vagrant images
- Terraform multi-cloud provisioning automation
-
Hashicorp Vault and Consul to generate and hold secrets
- Powershell Ecosystem
- Powershell on MacOS
- Jenkins Server Setup
- Jenkins Plug-ins
- Jenkins Freestyle jobs
- Docker (Glossary, Ecosystem, Certification)
- Make Makefile for Docker
- Docker Setup and run Bash shell script
- Bash coding
- Docker Setup
- Dockerize apps
- Ansible
- Kubernetes Operators
- Threat Modeling
- API Management Microsoft
- Scenarios for load
- Chaos Engineering