Skip to content

Latest commit

History

History
79 lines (54 loc) 路 2.42 KB

git.md

File metadata and controls

79 lines (54 loc) 路 2.42 KB

Git

The Git plugin in release-it, by default, does the following:

  1. Prerequisite checks
  2. [Files may be updated by other plugins and/or user commands/hooks]
  3. git add . --update
  4. git commit -m "[git.commitMessage]"
  5. git tag --annotate --message="[git.tagAnnotation]" [git.tagName]
  6. git push [git.pushArgs] [git.pushRepo]

When not in CI mode, release-it will ask for confirmation before each of the commit, tag, and push steps.

Configure the [git.*] options to modify the commands accordingly. See all options and their default values.

The minimum required version of Git is v2.0.0.

SSH keys & Git remotes

SSH keys and Git remotes are assumed to be configured correctly. If a manual git push from the command line works, release-it should be able to do the same.

The following help pages might be useful:

Remote repository

By default, release-it uses branch's tracking information, unless there isn't any, in which case it defaults to "origin" as the remote name to push to. Use git.pushRepo to override this with a different remote name, or a different git url.

Extra arguments

In case extra arguments should be provided to Git, these options are available:

  • git.commitArgs
  • git.tagArgs
  • git.pushArgs

For example, use "git.commitArgs": ["-S"] to sign commits (also see #35).

Skip Git steps

To skip the Git steps entirely (for instance, if you only want to npm publish), this shorthand is available:

release-it --no-git

Use e.g. git.tag: false or --no-git.tag to skip a single step.

Untracked files

By default, untracked files are not added to the release commit. Use git.addUntrackedFiles: true to override this behavior.

Further custimizations

In case you need even more freedom, here is some inspiration:

{
  "git": {
    "push": false
  },
  "hooks": {
    "after:git:release": "git push origin HEAD"
  }
}

Since the after:git:release hook runs after the Git commands, the git.push can be disabled, and replaced by a custom script.