brewly — Ch.5 · Follow the commit convention
Exercise 3 of 6
Before you start
Conventional Commits
Many teams start every summary with a type: feat: for a new feature, fix: for a bug fix, docs:, refactor:, test: or chore: for the rest. An optional scope names the area: fix(cart): round the total.
Tools can then write changelogs and pick version numbers from the history. That only works if each commit holds one kind of change.
The same format is common for pull request titles, because a squash merge turns the title into the commit.
- git status
- what changed?
- git add <file>
- stage one change
- git commit -m "type: summary"
- commit it
- git push -u origin <branch>
- publish the branch
Pull requests
Teams rarely commit to main directly. You push a branch and open a pull request: a proposal to merge it, where colleagues read the changes and comment before it goes in.
Pull requests are not part of git. They come from the service hosting the repository, such as GitHub or GitLab. Here, open them with the Pull request button above the code.
export function renderCart(cart) {const total = cart.reduce((sum, item) => sum + item.price, 0)document.querySelector('#total').textContent = (Math.round(total * 100) / 100).toFixed(2)}
Graph
- 1354d06 Add menu pageHEAD → feature/tipsorigin/mainmain
- 619eb3b Style the order button
- 5fc44ac Initial commit