Tips for writing better Commit Messages
Writing detailed and easy to understand commit messages are extremely important so that you and other team members can understand what tasks were completed during each commit. After reading this article we hope you’ll be better at writing commit messages. First lets talk about the workflow for committing and pushing to a team repository.
1.) git pull upstream master :
Pull from the remote repository and make sure that everything on your machine is up to date with the team’s changes.
2.) git add .
Next add all of your modified files. To check whether everything was successfully added run the command <git status>. All of your updated files should be in green.
3.) git commit
Commit all of your changes.
4.) git push origin <your branch name>
Push to your branch.
5.) got to GitHub pull request and Merge pull request
Go to GitHub to accept and merge your pull request.
Now lets get to writing proper commit messages. Use the following prefixes to preface all of your commits:
- (feat) Added a new feature
- (fix) Fixed inconsistent tests [Fixes #0]
- (refactor) …
- (cleanup) …
- (test) …
Write detailed and concise messages following the prefix. Make changes and commit on your branch. Only make changes that are relevant that are relevant to your branch and create a new branch with a descriptive new name when you begin working on something else.
Follow these rules to write better commit messages! Happy Coding!