DEV Community

Md:Jakaria
Md:Jakaria

Posted on

🚀 Smart Git Commit Guide

Banner showing Smart Git Commit Guide with Git logo, terminal commit examples, and a clock representing date and time based commits

Clean, Meaningful & Time-Aware Commits

TL;DR
Git commit history āĻļ⧁āϧ⧁ code āύāĻž — āĻāϟāĻž āĻāĻ•āϜāύ developer āĻšāĻŋāϏ⧇āĻŦ⧇ āϤ⧋āĻŽāĻžāϰ storyāĨ¤
āĻāχ guide āĻĻ⧇āĻ–āĻžāĻŦ⧇ āϕ⧀āĻ­āĻžāĻŦ⧇ āϖ⧁āĻŦ āϏāĻšāĻœā§‡ clean, readable, time-aware commit messages āϰāĻžāĻ–āĻž āϝāĻžā§Ÿ — without extra effort.


🌱 A Small Story (Why this matters)

āϧāϰ⧋ āφāϜ āϤ⧁āĻŽāĻŋ āĻāĻ•āϟāĻž bug fix āĻ•āϰāϞ⧇āĨ¤
ā§Š āĻŽāĻžāϏ āĻĒāϰ⧇ āφāĻŦāĻžāϰ āϏ⧇āχ file āϖ⧁āϞāϞ⧇ — āϤāĻ–āύ āĻ•āĻŋ āĻŽāύ⧇ āĻĨāĻžāĻ•āĻŦ⧇ āϕ⧇āύ change āĻ•āϰ⧇āĻ›āĻŋāϞ⧇?

āϝāĻĻāĻŋ commit message āĻšā§Ÿ:

update
Enter fullscreen mode Exit fullscreen mode

Future-you āĻŦāϞāĻŦ⧇ 😐
“āĻāχāϟāĻž āφāĻŽāĻŋ āϕ⧇āύ āĻ•āϰāĻ›āĻŋāϞāĻžāĻŽ?”

āĻāχ problem solve āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝāχ āĻāχ Smart Git Commit GuideāĨ¤


🧠 The Idea (Simple but Effective)

āĻāχ guide-āĻāϰ goal āϖ⧁āĻŦ simple:

  • Commit message āĻĻ⧇āϖ⧇āχ āĻŦā§‹āĻāĻž āϝāĻžāĻŦ⧇

    • āϕ⧀ change
    • āĻ•āĻŦ⧇ change
  • Beginner-friendly āĻšāϤ⧇ āĻšāĻŦ⧇

  • Daily use-āĻ extra āϚāĻŋāĻ¨ā§āϤāĻž āϞāĻžāĻ—āĻŦ⧇ āύāĻž

  • Public GitHub repo-āϤ⧇ confidently share āĻ•āϰāĻž āϝāĻžāĻŦ⧇

Solution? 👉 A smart Git alias: cmt


🔑 What is cmt?

cmt = Commit with Time

āĻŽāύ⧇ āϰāĻžāĻ–āĻžāϰ trick:

  • cm → commit
  • t → time

So,

git cmt
Enter fullscreen mode Exit fullscreen mode

āĻŽāĻžāύ⧇ commit + auto date & time

āĻāϟāĻž Git-āĻāϰ built-in command āύāĻžāĨ¤
āĻāϟāĻž āĻāĻ•āϟāĻž custom alias, āϝ⧇āϟāĻž Git workflow-āϕ⧇ smarter āĻ•āϰ⧇āĨ¤


đŸ–ŧī¸ How commit messages look

✅ Default (Date + Time)

fix login validation || 2026-01-15 03:01 PM
Enter fullscreen mode Exit fullscreen mode

✅ Sometimes (Only Date)

cleanup unused code || 2026-01-15
Enter fullscreen mode Exit fullscreen mode

âœ”ī¸ Clean
âœ”ī¸ Readable
âœ”ī¸ Professional


âš™ī¸ One-Time Setup (Do this once)

āĻāχ āĻ…āĻ‚āĻļāϟāĻž āĻāĻ•āĻŦāĻžāϰāχ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤

Step 1: Open terminal

  • macOS → Terminal
  • Windows → Git Bash
  • Linux → Terminal

Step 2: Run this command

git config --global alias.cmt '!f() {
  if [ "$1" = "-d" ] || [ "$1" = "--date-only" ]; then
    git add -A && git commit -m "${2:-general update} || $(date "+%Y-%m-%d")" && git status
  else
    git add -A && git commit -m "${1:-general update} || $(date "+%Y-%m-%d %I:%M %p")" && git status
  fi
}; f'
Enter fullscreen mode Exit fullscreen mode

🎉 Done!
āφāϰ setup āύāĻŋā§Ÿā§‡ āϚāĻŋāĻ¨ā§āϤāĻž āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āύāĻžāĨ¤


â–ļī¸ Daily Usage (Very Easy)

✅ Most common use (Date + Time)

git cmt "fix payment issue"
Enter fullscreen mode Exit fullscreen mode

Result:

fix payment issue || 2026-01-15 03:01 PM
Enter fullscreen mode Exit fullscreen mode

✅ Sometimes (Time āĻĻāϰāĻ•āĻžāϰ āύ⧇āχ)

git cmt -d "small refactor"
Enter fullscreen mode Exit fullscreen mode

Result:

small refactor || 2026-01-15
Enter fullscreen mode Exit fullscreen mode

✅ Lazy day 😄 (No message)

git cmt
Enter fullscreen mode Exit fullscreen mode

Result:

general update || 2026-01-15 03:01 PM
Enter fullscreen mode Exit fullscreen mode

đŸŽ¯ When to use what?

Situation Use
Important feature / bug Date + Time
Small cleanup Only Date
Quick change Any

Rule simple:

Change āϝāϤ important, detail āϤāϤ āĻŦ⧇āĻļāĻŋ


🔍 Check your last commit (No GitHub needed)

GitHub āϖ⧁āϞ⧇ āĻĻ⧇āĻ–āĻžāϰ āĻĻāϰāĻ•āĻžāϰ āύ⧇āχāĨ¤
Terminal āĻĨ⧇āϕ⧇āχ last commit āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāϰ⧋:

git log -1
Enter fullscreen mode Exit fullscreen mode

Example output:

commit a1b2c3d4
Author: Your Name
Date:   Thu Jan 15 15:01:22 2026 +0600

    fix payment issue || 2026-01-15 03:01 PM
Enter fullscreen mode Exit fullscreen mode

āĻāϤ⧇āχ clear āĻŦā§‹āĻāĻž āϝāĻžā§Ÿ:

  • āĻļ⧇āώ commit āϕ⧀
  • Message āĻ āĻŋāĻ• āφāϛ⧇ āĻ•āĻŋāύāĻž
  • Date & time āĻ āĻŋāĻ• āφāϛ⧇ āĻ•āĻŋāύāĻž

âš™ī¸ What happens behind the scenes?

āĻĒā§āϰāϤāĻŋāĻŦāĻžāϰ git cmt āϚāĻžāϞāĻžāϞ⧇ āφāϏāϞ⧇ Git āĻāϟāĻž āĻ•āϰ⧇:

git add -A
git commit -m "your message || formatted date/time"
git status
Enter fullscreen mode Exit fullscreen mode

So you get:

  • No forgotten files
  • Clean workflow
  • Instant feedback

❓ FAQ

❓ Why not VS Code snippets?

VS Code snippets AM/PM support āĻ•āϰ⧇ āύāĻžāĨ¤
Shell date command āĻ•āϰ⧇ — āϤāĻžāχ alias āĻŦ⧇āĻļāĻŋ reliableāĨ¤


❓ Will GitHub change the commit message?

āύāĻžāĨ¤ GitHub commit message āĻ āĻŋāĻ• āϝ⧇āĻ­āĻžāĻŦ⧇ āĻĻāĻžāĻ“, āϏ⧇āĻ­āĻžāĻŦ⧇āχ āϰāĻžāϖ⧇āĨ¤


❓ Want to remove this alias?

git config --global --unset alias.cmt
Enter fullscreen mode Exit fullscreen mode

🏁 Final Thoughts

āĻāχ guide āĻŦāĻžāύāĻžāύ⧋ āĻšā§Ÿā§‡āϛ⧇ āϝ⧇āύ:

  • Beginners āϭ⧟ āύāĻž āĻĒāĻžā§Ÿ
  • Daily Git usage fast āĻšā§Ÿ
  • Commit history clean āĻĨāĻžāϕ⧇
  • Developer āĻšāĻŋāϏ⧇āĻŦ⧇ professionalism āĻĢ⧁āĻŸā§‡ āĻ“āϠ⧇

Good commit history = confident developer


🔗 Want to understand this guide better?

📘 Visit our GitHub repository:
👉 Smart Git Commit Guide
https://github.com/ikramuzzaman455173/smart-git-commit-guide

āϏ⧇āĻ–āĻžāύ⧇ āĻĒāĻžāĻŦ⧇:

  • Full documentation
  • Examples
  • Updates & improvements

Happy coding & happy committing 🚀
āĻāχ guide āĻ•āĻžāĻœā§‡ āϞāĻžāĻ—āϞ⧇ team-āĻāϰ āϏāĻžāĻĨ⧇ share āĻ•āϰāϤ⧇ āϭ⧁āϞ⧋ āύāĻž 💙

Top comments (0)