Perform the git-operations in nodeJs.
npm i av-git-operation --save
OR
yarn add av-git-operation
- Import the module
const gitOperation = require("av-git-operation");
- Clone a repo using
gitOperation.clone(
"YOUR HOST REPO URL",
"FOLDER PATH WHERE YOU WANT TO PUT REPO",
{ checkout: "Your Branch Name" },
(err) => {
if (err) {
throw err;
}
console.log("Cloning Done");
}
);
- Config the git user
gitOperation.config(
"FOLDER PATH WHERE YOU PUT REPO",
{ email: configUserEmail, name: configUserName },
(err) => {
if (err) {
throw err;
}
console.log("Config Done");
}
);
- Commit the repo
gitOperation.commit(
"FOLDER PATH WHERE YOU PUT REPO",
{ message: commitMessage },
(err) => {
if (err) {
throw err;
}
console.log("Commit Done");
}
);
- Push the changes to your repo
gitOperation.push(
"FOLDER PATH WHERE YOU PUT REPO",
{ branch: "Your Branch Name" },
(err) => {
if (err) {
throw err;
}
console.log("Push Done");
}
);
- File change status of your repo
gitOperation.status("FOLDER PATH WHERE YOU PUT REPO", (result, err) => {
if (err) {
throw err;
}
console.log(result);
});
Use debug to print the useful information.
{
debug: true;
}
This is an open source project, so feel free to contribute. How?
- Open an issue.
- Propose your own fixes, suggestions and open a pull request with the changes.
Umesh Verma