Best way to use npm and git?

I’m quite new to both git and npm, but I understand the basics, at least I think I understand.
Anyway I will describe the way I’m thinking to work, but I think there are better ways to do.

  • I create the root folder with my node.js module.
  • I add the package.json file and configure the name and the version.
  • git init in this root folder.
  • Then git add . to add all the files to the source control.
  • Commit it. This would be my version 0.0.1. I don’t know how to set this in the git.
  • npm publish
  • And this is all for the first cycle.

Now for the next little change, not version:

  • I change a file.
  • I change the version in package.json to 0.0.2.
  • I git commit.
  • done.
  • Same for other little changes, but don’t change the version.

Now for the next version change:

  • I change the files
  • I change the version to the next.
  • I git commit.

I would need some reference between the npm version and git version. How to do it?

  • Merging branch not creating conflicts to resolve
  • .NET: Large revision numbers in AssemblyVersionAttribute
  • Display all files, by a user contributed, in a repo
  • Unable to clone using Git over HTTP
  • Understanding TFS from a Git background; specifically how branching differs in TFS
  • Why Kiln is based on Mercurial, and not other (D)VCS
  • Best pratice for multiple custom projects and Git
  • Xcode 5 - How to use source control with a workspace
  • One Solution collect form web for “Best way to use npm and git?”

    best practise is to add


    to .gitignore 🙂

    git is source control system and npm is package managment, ignore stuff like native packages that you use and thats all all the resto or “real” code has to go to module. Also if you have any config files like database.json put thme into ignore and put into repo sample like database.json.sample

    Thats it! :>

    You change npm package verison only when you have few comits and feature changes 🙂 so it is exclusive.

    Git Baby is a git and github fan, let's start git clone.