In my previous blog post, I wrote why it is important to write good commit messages.
In this post I will highlight an example how this works in your advantage. Using an AWS CodeCommit repository.
Working example
Alright, lets assume we have a project that uses a main
branch. In combination with feature branches.
We want to add a feature to our project, so we create a branch called: feat/my-feature
.
Let say we manage to get the feature working in a single commit. The commit message would look something like this:
feat: add support for x
By adding support for x we allow x users to adopt this tool in their workflow.
Issue: #123
Now it is time to create a pull request! I have created a tool called pull-request-codecommit.
This tool looks at the differences between the current branch. And the target branch and proposes a pull request message.
So if you want to create a pull request you type:
git pr
The default editor is opened. And in this editor you will see:
feat: add support for x (#123)
By adding support for x we allow x users to adopt this tool in their workflow.
Issue: #123
The first line will be used as the title and the rest as a description.
You can alter the message to your liking, but if you use a proper commit message this is spot on already.
When you save the proposal the pull request is created for you:
For convenience the link is displayed and the eventual message. When you open the link the pull request will look like this:
What about many commits?
When many commits are used the tool tries to propose a good pull request message. When you split your commits.
And you used proper messages it looks something like this:
As you can see, the first commit is used as the title. The rest of the commit titles are shown as a list in the description.
Conclusion
When you write proper commit messages, you help your self. It makes it easier for you to draft pull requests.
And it allows you to start using tools because you use standards.
Top comments (0)