Skip to content
Snippets Groups Projects
Commit 39d07d98 authored by George Adrian Stoica's avatar George Adrian Stoica
Browse files

docs: update slides for lecture 15

parent 9ce16c45
No related branches found
No related tags found
No related merge requests found
Pipeline #142924 passed
...@@ -23,9 +23,6 @@ IT1901 Fall 2021 - {LECTURE_NO} ...@@ -23,9 +23,6 @@ IT1901 Fall 2021 - {LECTURE_NO}
[color = "#fff6d5"] [color = "#fff6d5"]
== Planning development tasks == Planning development tasks
== Planning development tasks
- workflow and conventions - workflow and conventions
- prevent conflicts and complicated merges - prevent conflicts and complicated merges
- run checks before sharing changes - run checks before sharing changes
...@@ -33,13 +30,14 @@ IT1901 Fall 2021 - {LECTURE_NO} ...@@ -33,13 +30,14 @@ IT1901 Fall 2021 - {LECTURE_NO}
== Workflow and conventions == Workflow and conventions
agree on workflow and conventions the team is using, have that documented and available in your repository - agree on workflow and conventions the team is using
- branching strategies - have that documented and available in your repository
- branch naming ** branching strategies
- commit message format ** branch naming
- issue templates ** commit message format
- MR templates ** issue templates
- use of labels and boards in gitlab ** MR templates
** use of labels and boards in gitlab
== Prevent conflicts and complicated merges == Prevent conflicts and complicated merges
...@@ -51,6 +49,7 @@ agree on workflow and conventions the team is using, have that documented and av ...@@ -51,6 +49,7 @@ agree on workflow and conventions the team is using, have that documented and av
== Test and check before sharing changes == Test and check before sharing changes
before pushing (especially to long lived branches like main/master) before pushing (especially to long lived branches like main/master)
- make sure everything builds and runs - make sure everything builds and runs
- verify that the code passes all tests and quality checks - verify that the code passes all tests and quality checks
...@@ -58,9 +57,6 @@ before pushing (especially to long lived branches like main/master) ...@@ -58,9 +57,6 @@ before pushing (especially to long lived branches like main/master)
[color = "#fff6d5"] [color = "#fff6d5"]
== Committing strategies and best practices == Committing strategies and best practices
== Committing strategies and best practices
- small commits dealing with a single topic - small commits dealing with a single topic
- stage just the changes that are relevant - stage just the changes that are relevant
- you can stage just part of the changes to a file to include in a commit - you can stage just part of the changes to a file to include in a commit
...@@ -86,6 +82,7 @@ before pushing (especially to long lived branches like main/master) ...@@ -86,6 +82,7 @@ before pushing (especially to long lived branches like main/master)
== Staging file parts options (2) == Staging file parts options (2)
[.smaller-80]
- *j* leave this hunk undecided, see next undecided hunk - *j* leave this hunk undecided, see next undecided hunk
- *J* leave this hunk undecided, see next hunk - *J* leave this hunk undecided, see next hunk
- *k* leave this hunk undecided, see previous undecided hunk - *k* leave this hunk undecided, see previous undecided hunk
...@@ -153,8 +150,9 @@ https://xkcd.com/1296/ ...@@ -153,8 +150,9 @@ https://xkcd.com/1296/
- more types: build, chore, ci, docs, style, refactor, perf, test - more types: build, chore, ci, docs, style, refactor, perf, test
- footers other than BREAKING CHANGE: `<description>` may be provided and follow a convention similar to git trailer format (`token: value`). - footers other than BREAKING CHANGE: `<description>` may be provided and follow a convention similar to git trailer format (`token: value`).
== Why to use the conventional commits: == Why to use the conventional commits?
[.smaller-80]
- Automatically generating CHANGELOGs. - Automatically generating CHANGELOGs.
- Automatically determining a semantic version bump (based on the types of commits landed). - Automatically determining a semantic version bump (based on the types of commits landed).
- Communicating the nature of changes to teammates, the public, and other stakeholders. - Communicating the nature of changes to teammates, the public, and other stakeholders.
...@@ -164,6 +162,7 @@ https://xkcd.com/1296/ ...@@ -164,6 +162,7 @@ https://xkcd.com/1296/
== What to write in the commit message == What to write in the commit message
[.smaller-80]
- the subject line is the most important - the subject line is the most important
- clearly state the original issue / problem - clearly state the original issue / problem
- clearly state *why* the change is made - clearly state *why* the change is made
...@@ -178,6 +177,16 @@ Finally, read the message before committing as it might reveal that you should s ...@@ -178,6 +177,16 @@ Finally, read the message before committing as it might reveal that you should s
- use tools such as commitlint and commitizen to check the messages - use tools such as commitlint and commitizen to check the messages
- use git hooks check the message format - use git hooks check the message format
== Install Commitizen
- `npm install -g commitizen`
- `npm install -g cz-conventional-changelog`
- `echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc`
== Install Commitlint
- `npm install -g @commitlint/cli @commitlint/config-conventional`
- `echo "module.exports = {extends: ['@commitlint/config-conventional']}" > ~/commitlint.config.js`
== Commit hooks == Commit hooks
...@@ -185,9 +194,38 @@ Finally, read the message before committing as it might reveal that you should s ...@@ -185,9 +194,38 @@ Finally, read the message before committing as it might reveal that you should s
- can be global (all repositories) or local (the repo they are in) - can be global (all repositories) or local (the repo they are in)
- can be used to enforce commit message format - can be used to enforce commit message format
== git hook example
```bash
#!/bin/bash
echo "Checking commit message: "
# run any local commit-msg hook first
if test -f ./.git/hooks/commit-msg; then
echo "Running local git hook first."
sh ./.git/hooks/commit-msg
else
echo "Local hook does not exist."
fi
commitlint < $1
exit $status
```
[background-color = "#124990"] [background-color = "#124990"]
[color = "#fff6d5"] [color = "#fff6d5"]
== Demo == Demo
== References
- https://eidson.info/post/using-conventional-commit-messages-globally
- https://wiki.openstack.org/wiki/GitCommitMessages
include::{includedir}footer.adoc[] include::{includedir}footer.adoc[]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment