Skip to content

Instantly share code, notes, and snippets.

@cojack
Created February 8, 2017 15:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cojack/8347bd679f82997ebce65ab44e7b1fe4 to your computer and use it in GitHub Desktop.
Save cojack/8347bd679f82997ebce65ab44e7b1fe4 to your computer and use it in GitHub Desktop.
Automatically bump version in package.json and commit it, merge to master, then create tag and push evrything to origin
bump_version () {
git fetch origin
git checkout develop
git pull origin develop
npm version patch --no-git-tag-version
VERSION=$(grep -m1 version package.json | awk -F: '{ print $2 }' | sed 's/[", ]//g')
git commit package.json -m "chore(package): Bump version up to $VERSION"
git push origin develop
git checkout master
git pull origin master
git merge --no-ff --no-edit develop
git tag "$VERSION"
git push
git push --tags
}
alias git-bump="bump_version"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment