This is the third post in my series of Git tips for both new and experienced Git users. It is the follow up to yesterday's tip on changing the editor for interactive Git rebase.
The List
The full list of my Git tips is here.
Why change the comment character?
The default comment character in an interactive Git rebase is #
. This is fine until you want change a commit message which begins with a #
.
Why would you want to do that? We have a convention where we begin our commit messages with a #
followed by the work item number. This has the advantage that when looking down the history it's easy to see what was worked on. Additionally tools like VSTS and GitHub will link commits to work items if #{work item id}
is included in the commit message.
The Command
Open a command prompt and type the following command:
git config --global core.commentchar "*"
It's as simple as that.
I like *
, but you can choose any character you like as long as it's a single character and it doesn't conflict with the character you want to begin you commit messages with.