前端开源库-tiny-commit-walker

  • Z9_477357
    了解作者
  • 3.9MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-29 07:06
    上传日期
前端开源库-tiny-commit-walker小任务步行者,小任务步行者
前端开源库-tiny-commit-walker.zip
内容介绍
# Tiny commit walker Tiny git commit walker has no native modules. [![Build Status](https://travis-ci.org/ukyo/tiny-commit-walker.svg?branch=master)](https://travis-ci.org/ukyo/tiny-commit-walker) [![Build status](https://ci.appveyor.com/api/projects/status/y6icdkcok01fq927/branch/master?svg=true)](https://ci.appveyor.com/project/ukyo/tiny-commit-walker/branch/master) [![npm version](https://badge.fury.io/js/tiny-commit-walker.svg)](https://badge.fury.io/js/tiny-commit-walker) # Install ``` $ npm install --save tiny-commit-walker ``` # Usage ```js import { Repository } from 'tiny-commit-walker'; (async () => { const repo = new Repository('path/to/repo/.git'); // const repo = new Repository(await Repository.findGitDir('path/to/repo')); const branches = await repo.readBranches(); const tags = await repo.readTags(); const branch = await repo.readCommitByBranch('master'); console.log(branch.name); // master let commit = branch.commit; while (commit.hasParents) { console.log(commit.hash); commit = await commit.walk(); // default parameter of commit.walk is base parent hash. } })(); // or const repo = new Repository('path/to/repo/.git'); const branches = repo.readBranchesSync(); const tags = repo.readTagsSync(); const branch = repo.readCommitByBranchSync('master'); console.log(branch.name); // master let commit = branch.commit; while (commit.hasParents) { console.log(commit.hash); commit = commit.walkSync(); } ``` # Documentation https://ukyo.github.io/tiny-commit-walker
评论