Here is a best practices for naming and committing changes to your branch
Use basic types in your branch name such as :
feature
,environment
,bugfix
,refactoring
That gives us ability to have better understanding of brunch purposes
git checkout -b feature/<task-id>/add-user-auth
Use
/
separator in your branch name If helps us to group our branches in directories when we use
Source tree or any other tool for git visualization
git checkout -b feature/user/list
-feature
--user
---list
For commits use :
feat:
,fix:
,ref:
,env
Commit types helps us to track progress of main branch
also it autogenerate title of yourPR
git commit -m "feat: Created user login form"
You should split your task into a logic commits.
It saves a lot of time forPR
reviewers.
git add ./components/user-login
git commit -m "feat: User Login Component"
git add ./store/user
git commit -m "feat: User actions, reducer, selectors "
Attach task links (Trello, Jira, etc.) to your commits
git commit -m "
feat: User Login Component
Task Description
Task: http://faketrello/fake-task
"
If you feace with some braking changes for code base
you should add additional description for those changes with the reasons (especially for refactoring)
git commit -m "
ref: User Reducer Rework
Old implementation of user reducer made our code looks like spaghetti : )`
Task: http://faketrello/fake-task
"
If you are received minor comments in your
PR
.
Don't create any additional commits for that.
Much better to apply changes to existent commit.
git add ./some-files-with-minor-changes/
git commit --amend
If you work on some huge feature you should keep your up to date.
Instead of merge your master brunch directly you should merge it with--no-commit
flag.
Looks much better when your brunch doesn't have any trash commits, isn't it ? : )
git fetch origin master
git merge master --no-commit
Always attach description and proper title to your
PR
.
Also try to attach images for UI tasks.
For backend task always attach API documentation links.
Always attach task link to the bottom of your description.
UI:
Description of your UI task
Images:
<images with your work>
Task: http://faketrello/fake-task
Backend:
Description of your UI task
API: http://some-fake-api-link-with-your-docs/fake-user-api
Task: http://faketrello/fake-task