Download the PHP package zeeshan/git-semver without Composer
On this page you can find all versions of the php package zeeshan/git-semver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package git-semver
git-semver
A CLI tool to generate semantic versioning compliant tags for your git repositories.
Install
- Download the file from here
- Assign required permissions
sudo chmod -R 755 git-semver - Run
sudo mv git-semver /usr/local/bin/git-semver
Usage
Below is the signature for command
Where patch, minor or major specifies the type of release that you are about to make.
patchuse this option when you make backwards-compatible bug fixesminoruse this option when you add functionality in a backwards-compatible mannermajoruse this option when you make incompatible API changes
Options
In addition to the type of release i.e. patch, major or minor, you can add following options to modify the behavior of command
--fetchFetch the remote tags before applying the version (Recommended)--prefixPrefix to prepend to the tag e.g.--prefix=vto prependvi.e. for tags similar tov1.0.1--postfixAppend to the tag e.g--postfix="-live"to append-liveto generate tags similar to1.2.3-live
Examples
Find some of the usage examples below
Tag Examples
-
Below command creates a patch release i.e. increment the last part of the tag by 1 e.g. it will generate
x.y.1, if the last tag wasx.y.0 -
Below command creates a minor release i.e. middle part of the tag will be incremented e.g. if the last tag was
x.2.zthen it will becomex.3.z - Below command will create a major release i.e. the first part of the tag will be incremented e.g. if the last tag was
0.y.zthen it will become1.y.z
Fetching Remote Tags
If you would want to fetch the remote tags before creating the tag, then use the --fetch option. For example
Above command will make sure that the remote tags are fetched before creating a new tag. On a sidenote, it is recommended to add this flag e.g. if you are working in a team it is quite possible that you might not have some tag locally and creating a tag without fetching might end up in duplicated tags.
Prefix and Postfix Usage
- Prefix
If you want to create a release while prefixing some keyword e.g.
vthen you can provide that using--prefixoption. For example:
The above command will generate tags with v prefixed e.g. v1.0.0 or v1.3.2.
- Postfix
If you would like to append something to the end of created tag you can use
--postfixoption. For example, if you would want to append-devto the tag, you can do the below
This will result in something along the lines of 3.5.1-dev depending upon the last tag
A Real World Example of Semantic Versioning
Some useful examples of semantic versioning are given below:
Contribution
Feel free to fork, improve, create issues and spread the word.
License
MIT © Zeeshan Ahmed