3

I am starting to get into versions/releases more now with Git and wanted to know if the structure I am doing now is correct.

Right now, there is typically a few feature branches. A few commits from those then get merged into the develop branch for review.

After that I merge them into the master and the package.json version gets bumped up depending if it's a major, minor or patch and then a new release is created.

Should the package.json version be getting updated every commit though? or can I do this in stages with commits that I want to push towards a specific version.

Right now this is just a simple project, but I want to know if this is the correct workflow and what other best practices are for proper version numbering in a package/repository.

  • This depends a lot on the language and framework you're using as well as your downstream process. E.g., it sounds like you're using node.js, which has community-driven conventions about when to bump versions. Additionally, the answers will differ depending on if you're releasing publicly (e.g., to npm) or not. – Kris Harper Oct 6 '17 at 13:34
2

Looks like you are working with JavaScript (Node.js).

The workflow you have described appears correct. When you update package.json is when you have something new to release. If this is every commit then yes be it so, otherwise when changes get merged into master for a new release, its the correct time to up the package version.

The new version number of the package.json signals the users of the package that there are new, usable, released changes in the package made by the package maintainer(s).

  • commit number/id/hash - changes every time you have a new commit
  • build number - ups every time you build your code, usually with one or more commits in it (usually your continuous integration will give you this)
  • package version - ups every time you ship new changes to users of the package, usually after a stable build.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.