Giter VIP home page Giter VIP logo

wgittools's Introduction

module::GitTools status stable

Collection of tools to use git programmatically.

Try out from the repository

git clone https://github.com/Wandalen/wGitTools
cd wGitTools
will .npm.install
node sample/trivial/Sample.s

Make sure you have utility willbe installed. To install willbe: npm i -g willbe@stable. Willbe is required to build of the module.

To add to your project

npm add 'wgittools@stable'

Willbe is not required to use the module in your project as submodule.

Examples

Status for repository

Clone any repository. For example wTools.

Write script Script.s in the root of cloned repository :

const _ = require( 'wgittools' );
let status = _.git.status
({
  localPath : __dirname,
  detailing : 1,
  explaining : 1
});

console.log( status );
/* log :
[Object: null prototype] {
  uncommitted: 'List of uncommited changes in files:\n  ?? script.s\n  M package.json',
  unpushed: false,
  uncommittedUntracked: '?? Script.s',
  uncommittedAdded: false,
  uncommittedChanged: 'M package.json',
  uncommittedDeleted: false,
  uncommittedRenamed: false,
  uncommittedCopied: false,
  uncommittedIgnored: null,
  uncommittedUnstaged: false,
  conflicts: false,
  unpushedCommits: false,
  unpushedTags: false,
  unpushedBranches: false,
  status: 'List of uncommited changes in files:\n  ?? script.s\n  M package.json',
  remoteCommits: false,
  remoteBranches: null,
  remoteTags: false,
  local: 'List of uncommited changes in files:\n  ?? script.s\n  M package.json',
  remote: false
}
*/

Install dependency wgittools by command npm i wgittools and then run command node Script.s.

Compare the output with the log above.

The status contains many information about local and remote repository including conflicts between files and unpulled changes.

The current log shows that in root directory added file Script.s ( uncommittedUntracked: '?? Script.s' ), and file package.json was modified.

Init an empty repository

Create an empty directory and add file Script.s with next content ( replace USER and TOKEN with your Github username and Github acces token respectively ):

const _ = require( 'wgittools' );

_.git.repositoryInit
({
  remotePath : 'https://github.com/USER/Test-repo.git',
  localPath : _.path.join( __dirname, 'Test-repo' ),
  description : 'Test repository',
  token : TOKEN,
});

Run command npm i wgittools and then run script by command node Script.s.

Check current directory, script will create local git repository in directory Test-repo. Run next commands :

cd Test-repo
git remote -v

Output should looks like :

origin	https://github.com/USER/Test-repo.git (fetch)
origin	https://github.com/USER/Test-repo.git (push)

Also, check your Github repositories. The new repository Test-repo should exist.

wgittools's People

Contributors

dmvict avatar jackiejoo avatar mva-gh avatar testpersonal avatar wandalen avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.