Skip to content

Commit

Permalink
docs(readme): move the explanation of sort flag to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Sep 28, 2021
1 parent c62ca03 commit a0635ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ git-cliff [FLAGS] [OPTIONS] [RANGE]
-t, --tag <TAG> Sets the tag for the latest version [env: TAG=]
-b, --body <TEMPLATE> Sets the template for the changelog body [env: TEMPLATE=]
-s, --strip <PART> Strips the given parts from the changelog [possible values: header, footer, all]
--sort <sort> Sets sorting of the commits inside sections [default: oldest] [possible values: oldest, newest]
```

**Args:**
Expand Down Expand Up @@ -185,6 +186,17 @@ Generate a changelog scoped to a specific directory (useful for monorepos):
git cliff --commit-path project1/
```

Sort the commits inside sections:

```sh
# The oldest commit will be on top.
# (default)
git cliff --sort oldest

# The newest commit will be on top.
git cliff --sort newest
```

Save the changelog file to the specified file:

```sh
Expand Down
10 changes: 1 addition & 9 deletions git-cliff/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,7 @@ pub struct Opt {
#[structopt(value_name = "RANGE")]
pub range: Option<String>,

/// Sets sorting of the commits inside the sections
///
/// If sort is `oldest`, the oldest commit will be on top. {n}
/// - PR #1 {n}
/// - PR #2
///
/// If sort is `newest`, the newest commit will be on top. {n}
/// - PR #2 {n}
/// - PR #1 {n}
/// Sets sorting of the commits inside sections.
#[structopt(
long,
possible_values = &["oldest", "newest"],
Expand Down

0 comments on commit a0635ee

Please sign in to comment.