Skip to content

Commit ed3761a

Browse files
type: [docs], message: Add rebase instructions to README.md file.
1 parent 2c692f5 commit ed3761a

File tree

1 file changed

+45
-11
lines changed

1 file changed

+45
-11
lines changed

README.md

+45-11
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,56 @@ setup(
7676
install_requires=requirements,
7777
packages=find_packages(),
7878
)
79+
```
80+
81+
### Adding pre-commit message lint
82+
83+
The semantic-release `pre-commit message lint` will validate your commit messages before the commit being accepted.
84+
That will prevent you from having to rebase your commit history to adapt your commit messages to semantic-release standards.
85+
86+
Notes:
87+
1. To activate commit message template in a pre-existing local repository, go to the project root folder and run `git init` command.
88+
2. After `make commit-message-install`, Git will automatically activate commit message template to new cloned projects.
89+
90+
Run the following command:
91+
92+
```
93+
make commit-message-install
94+
```
95+
96+
If for some reason you need to skip commit lint, you can run git commit with the `--no-verify` tag as follows.
97+
98+
```
99+
git commit -m "type: [typo], message: We do not recommend doing this!" --no-verify
100+
```
101+
102+
We do not recommind using `--no-verify` for projects that use [commit lint ci step](#how-to-add-commit-lint-stage-to-gitlab) once it will validate all the branche commit messages.
103+
104+
If at least one commit message breaks semantic-release standards, you'll have to rebase and reword the wrong commit messages.
105+
106+
### How to use `rebase` to rename commit message?
107+
108+
If the [commit lint ci step](#how-to-add-commit-lint-stage-to-gitlab) fail, you can rebase you commit history and fix the wrong commit messages.
109+
110+
With your local repository up to date with your remote branch, run the following command.
111+
Note: `N` is the number of commits you pushed to your branch.
112+
113+
```
114+
git rebase -i HEAD~N
115+
```
116+
117+
Edit the document and replace the first word `pick` to `r` or `reword`. Save it with `ctrl+o` and close it with `ctrl+x`;
118+
119+
Force push it with `-f` tag as follows:
120+
121+
```
122+
git push -f origin my-branch-name
79123
```
80124
81125
### How to add commit lint stage to Gitlab?
82126
83127
You must add a new stage to `gitlab-ci.yml` file adding two new arguments to semantic-release script.
84-
- `commit-lint=true` to run commit-lint logic;
128+
- `-commit-lint=true` to run commit-lint logic;
85129
- `-branch-name=${CI_COMMIT_REF_NAME}` so that semantic-release can validate only the commits of the referenced branch.
86130
87131
```yaml
@@ -99,16 +143,6 @@ commit-lint:
99143
- docker run registry.com/dataplatform/semantic-release:$SEMANTIC_RELEASE_VERSION up -commit-lint=true -branch-name=${CI_COMMIT_REF_NAME} -git-host ${CI_SERVER_HOST} -git-group ${CI_PROJECT_NAMESPACE} -git-project ${CI_PROJECT_NAME} -username ${PPD2_USERNAME} -password ${PPD2_ACCESS_TOKEN}
100144
```
101145

102-
### Adding pre-commit message lint
103-
104-
Notes:
105-
1. To activate commit message template in a pre-existing local repository, go to the project root folder and run `git init` command.
106-
2. After `make commit-message-install`, Git will automatically activate commit message template to new cloned projects.
107-
108-
```
109-
make commit-message-install
110-
```
111-
112146
### If you need more information about the semantic release CLI usage you can run the following command.
113147

114148
```

0 commit comments

Comments
 (0)