Simple bash script to switch specific branch|commit|tag on target repositories.
With -h or --help, you can get usage information:
git version switcher: Checkout specific branch|commit|tag on targets
Usage: gvs [-h] [-u] [-r] [-v] <TARGET1> [TARGET2…]
-h | --help Display this help message
-u | --update Update default remote (fetch)
-r | --report-only Discard version switching, only report
-v | --verbose Verbose output
-V | --version Display version
TARGET A path and a branch|commit|tag separated by a colon (:)
For 'target', pass one or more path and branch|commit|tag separated by a colon (:) to specify a target. The first part should be a path to a git repository; the second part is the target branch|commit|tag.
Example: path/to/repo:1.2.3-beta.1
Notes:
- You can use relative, absolute and home (~) paths.
- If you were using a global variable for path, wrap it in curly braces ({}) to avoid interpreting the colon by the shell. Example:
${MY_PATH}:0.1.0 - This script installs composer dependencies upon version switch if a target contains a
composer.jsonfile in the root directory or in theplugins/woocommerce/subdirectory.
Download the bin/gvs file and make it executable (chmod +x gvs).
Add this repository to your composer.json file.
"repositories": [
{
"type": "git",
"url": "[email protected]:tectalic/git-version-switcher.git"
}
]Require this package as a development dependency with Composer.
composer require --dev tectalic/git-version-switcherAlternatively, you can install it globally.
composer global require tectalic/git-version-switcherInstall this package as a development dependency with npm.
npm install --D git+ssh://[email protected]/tectalic/git-version-switcher.gitAlternatively, you can install it globally.
npm install --g git+ssh://[email protected]/tectalic/git-version-switcher.gitgitcomposerwhen used for installation or WooCommerce amongst the targetsnpmwhen used for installation