@fork-of/git-branch

中文文档
2.1.1发布于 2021/11/11MITCommonJS近 30 天下载 45.5万

Get the current branch from the local git repository. Hopefully temporary fork of https://github.com/jonschlinkert/git-branch/

原始使用文档
文档目录7 节
  1. Install
  2. Usage
  3. About
  4. Related projects
  5. Contributors
  6. Author
  7. License

@fork-of/git-branch NPM version NPM monthly downloads NPM total downloads Linux Build Status

Get the current branch from the local git repository.

HOPEFULLY TEMPORARY FORK OF https://github.com/jonschlinkert/git-branch

Install

Install with npm:

$ npm install --save @fork-of/git-branch

Usage

const branch = require('@fork-of/git-branch');

Optionally pass the cwd (current working directory) as the first argument.

Promise

branch('some/path')
  .then(name => console.log('Branch:', name)) //=> 'Branch: master'
  .catch(console.error);

Callback

branch(function(err, name) {
  if (err) throw err;
  console.log('Branch:', name); //=> 'Branch: master'
});

Sync

console.log('Branch:', branch.sync()); //=> 'Branch: master'

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Running Tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

You might also be interested in these projects:

Contributors

| Commits | Contributor | | --- | --- | | 19 | jonschlinkert | | 6 | emilrowland |

Author

Jon Schlinkert

License

Copyright © 2018, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on March 09, 2018.

版本与发布记录

@fork-of/git-branch 共发布 2 个版本,首次发布于 2021/11/11;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.1.1latest2021/11/115 年前
2.1.02021/11/115 年前

关于 @fork-of/git-branch 的常见问题

@fork-of/git-branch 是什么?

Get the current branch from the local git repository. Hopefully temporary fork of https://github.com/jonschlinkert/git-branch/

如何安装 @fork-of/git-branch?

在项目目录运行 npm install @fork-of/git-branch,或使用 pnpm add / yarn add / bun add。

@fork-of/git-branch 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/fork-of__git-branch 是否存在。

@fork-of/git-branch 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fork-of/git-branch 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=8。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fork-of/git-branch 可以商用吗?

@fork-of/git-branch 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fork-of/git-branch 的下载量有多少?

根据 npm 官方下载统计,@fork-of/git-branch 在 2026/10/16 – 2026/11/14 这 30 天内被下载 454,793 次,日均约 15,160 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fork-of/git-branch 还在维护吗?

最新版本 2.1.1 发布于 2021/11/11(5 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/11/11。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。