V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
Septembers
V2EX  ›  分享创造

在 npm 安装 时 自动初始化 git-flow

  •  
  •   Septembers · 2020-02-18 10:03:51 +08:00 · 1630 次点击
    这是一个创建于 1536 天前的主题,其中的信息可能已经有所发展或是发生改变。

    本工具功能很简单

    即在 npm install 时通过 npm postinstall 这个 hook

    完成自动配置 git config 完成 git-flow 的初始化

    在团队协作时,可以避免 git-flow 的初始化配置不一致导致的各种问题

    https://github.com/NiceLabs/git-flow-init


    另一款工具是无外部依赖且实现干净的 git 信息获取

    例如 commit hash, commit date, latest message 等信息

    import git from "@nice-labs/git-rev";
    // short commit-hash
    console.log(git.commitHash(true)); // 75bf4ee
    // long commit-hash
    console.log(git.commitHash()); // 75bf4eea9aa1a7fd6505d0d0aa43105feafa92ef
    // branch name
    console.log(git.branchName()); // master
    

    https://github.com/NiceLabs/git-rev

    1 条回复    2020-02-18 16:16:43 +08:00
    isukkaw
        1
    isukkaw  
       2020-02-18 16:16:43 +08:00   ❤️ 1
    好耶!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2116 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 16:01 · PVG 00:01 · LAX 09:01 · JFK 12:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.