Skip to content

Commit fabbfc2

Browse files
committed
simplify usage examples
1 parent 56842db commit fabbfc2

File tree

1 file changed

+42
-22
lines changed

1 file changed

+42
-22
lines changed

README.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ go install github.com/kazhuravlev/git-tools/cmd/gt@latest
3333

3434
**Homebrew**
3535

36-
```shell
36+
```shell
3737
brew install kazhuravlev/git-tools/git-tools
3838
```
3939

@@ -45,37 +45,57 @@ echo 'alias gt="docker run -it --rm -v `pwd`:/workdir kazhuravlev/gt:latest"' >>
4545

4646
## Usage
4747

48-
By default, `gt` works with the repo in the current directory. If you want to
49-
specify another path to repo - add `--repo=/path/to/repo` flag.
48+
All commands work with the current directory by default. Use `--repo=/path/to/repo` to specify a different repository.
49+
50+
### Commands
51+
52+
**Tag Management:**
53+
54+
```shell
55+
gt tag last # Show last semver tag (alias: gt t l)
56+
gt tag last -f tag # Show only tag name (useful for CI/CD)
57+
58+
gt tag increment major # Bump major version: v1.2.3 → v2.0.0 (alias: gt t i maj)
59+
gt tag increment minor # Bump minor version: v1.2.3 → v1.3.0 (alias: gt t i min)
60+
gt tag increment patch # Bump patch version: v1.2.3 → v1.2.4 (alias: gt t i pat)
61+
```
62+
63+
**Other Commands:**
5064

5165
```shell
52-
gt --repo /path/to/repo tag last
66+
gt lint # Validate tag format consistency
67+
gt authors # List commit authors with statistics (alias: gt a)
68+
gt hooks install all # Install git hooks (alias: gt h i a)
69+
gt hooks list # List available hooks (alias: gt h l)
5370
```
5471

55-
| Command | Action |
56-
|---------------------|--------------------------------------------------------------|
57-
| `t l` | Show last semver tag in this repo |
58-
| `t i major` | Increment `major` part for semver |
59-
| `t i minor` | Increment `minor` part for semver |
60-
| `t i patch` | Increment `patch` part for semver |
61-
| `lint` | Run linter, that check the problems |
62-
| `hooks install all` | Install commit-msg hook that adds branch name to each commit |
72+
### Options
6373

64-
### Force add new semver tag
74+
**Force tag creation:**
6575

66-
By default `gt` will throw an error when you try to increment a tag on commit, that already have another semver tag.
76+
```shell
77+
# Create a new tag even if current commit already has a semver tag
78+
gt t i min --ignore-exists-tag
79+
```
6780

68-
In order to skip this error - provide additional flag to increment command like
69-
that: `gt t i min --ignore-exists-tag`.
81+
**Custom repository path:**
82+
83+
```shell
84+
gt --repo=/path/to/repo tag last
85+
```
7086

7187
### Examples
7288

7389
```shell
74-
# Get last semver tag in this repo
75-
$ gt tag last
76-
v1.9.0 (c2e70ec90579ba18fd73078e98f677aec75ae002)
90+
# Typical workflow: commit, bump version, push
91+
git commit -am "Add new feature"
92+
gt t i min # Creates v1.3.0 tag
93+
git push --follow-tags
94+
95+
# CI/CD: Get version for build artifact
96+
VERSION=$(gt tag last -f tag)
97+
echo "Building version: $VERSION"
7798

78-
# Show only tag name (useful for ci/cd)
79-
$ gt tag last -f tag
80-
v1.9.0
99+
# Check tag consistency before release
100+
gt lint
81101
```

0 commit comments

Comments
 (0)