The -m flag is convenient for tiny changes, but it actively works against best practices. Here’s why the COMMIT_EDITMSG workflow is superior:
During an interactive rebase ( git rebase -i ), you mark a commit as edit . Git stops and checks out that commit. You then run git reset HEAD^ to unstage files, stage partial changes, and run git commit . When you run git commit , the COMMIT_EDITMSG already contains the original commit message from the commit you are splitting. You can edit it to reflect the new, smaller change.
# <type>(<scope>): <subject> (max 50 chars) # |<---- using Conventional Commits ---->| # # <body> Explain *what* and *why*, not *how*. (72 chars max) # # <footer> Any closing notes or breaking changes. # # --- Commits will be signed off with your user.email ---
You are directly manipulating the COMMIT_EDITMSG file. This is legal, safe, and incredibly powerful.
If you are writing scripts that generate commits, you might want to programmatically construct a message.
Now, every time you commit, COMMIT_EDITMSG will open with this skeleton pre-filled, ensuring your team never forgets to add a "type" or reference a ticket number.
: Git launches your system's default text editor (like Vim, Nano, VS Code, or Notepad++) and opens this file.
# List any issues closed by this change (e.g., Closes #123) # -------------------- # Do not modify the lines above.
Copyright � 2019 GCCWALKINS.All Rights Reserved .
The -m flag is convenient for tiny changes, but it actively works against best practices. Here’s why the COMMIT_EDITMSG workflow is superior:
During an interactive rebase ( git rebase -i ), you mark a commit as edit . Git stops and checks out that commit. You then run git reset HEAD^ to unstage files, stage partial changes, and run git commit . When you run git commit , the COMMIT_EDITMSG already contains the original commit message from the commit you are splitting. You can edit it to reflect the new, smaller change.
# <type>(<scope>): <subject> (max 50 chars) # |<---- using Conventional Commits ---->| # # <body> Explain *what* and *why*, not *how*. (72 chars max) # # <footer> Any closing notes or breaking changes. # # --- Commits will be signed off with your user.email ---
You are directly manipulating the COMMIT_EDITMSG file. This is legal, safe, and incredibly powerful.
If you are writing scripts that generate commits, you might want to programmatically construct a message.
Now, every time you commit, COMMIT_EDITMSG will open with this skeleton pre-filled, ensuring your team never forgets to add a "type" or reference a ticket number.
: Git launches your system's default text editor (like Vim, Nano, VS Code, or Notepad++) and opens this file.
# List any issues closed by this change (e.g., Closes #123) # -------------------- # Do not modify the lines above.