npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tanyu_mg

v1.0.1

Published

A global npm package for simplified git operations with proxy support

Readme

mg-git-cli

一个带代理支持的全局 Git 命令行工具,简化代码仓库的日常操作。

功能特性

  • 代理支持 - 自动配置 HTTP/HTTPS 代理,无需手动设置环境变量
  • 简化操作 - mg pull / mg push 快速同步代码
  • 仓库管理 - mg cd 快速切换工作目录
  • 批量克隆 - mg clone 自动克隆到指定目录并添加到管理列表
  • 状态查看 - mg status 查看单个或所有仓库的状态

安装

# 全局安装
pnpm install -g .
# 或
npm install -g .

配置

设置代理

# 同时设置 HTTP 和 HTTPS 代理
mg config set proxy=http://127.0.0.1:7897

# 分别设置
mg config set http-proxy=http://127.0.0.1:7897
mg config set https-proxy=http://127.0.0.1:7897

设置仓库根目录

mg config set repos-path=D:/code/repos

查看配置

mg config list

命令使用

mg pull

从远程仓库拉取代码:

mg pull
mg pull -r origin    # 指定远程仓库

mg push

推送代码到远程仓库:

mg push
mg push -f           # 强制推送
mg push --no-set-upstream  # 不设置上游分支

mg clone

克隆远程仓库并自动添加到管理列表:

mg clone https://github.com/user/repo.git
mg clone https://github.com/user/repo.git -d D:/code/repo
mg clone https://github.com/user/repo.git --depth 1  # 浅克隆
mg clone https://github.com/user/repo.git -b dev     # 克隆指定分支

mg cd

切换到已添加的仓库目录(需要先配置 shell 集成):

# 首次使用需要初始化 shell 集成
mg init

# 然后使用
mg-cd repo-name
# 或
mg cd                # 查看所有可用仓库

mg status

查看仓库状态:

mg status            # 查看当前仓库状态
mg status -a         # 查看所有仓库状态
mg st                # 简写

Shell 集成

PowerShell

mg init --shell powershell

然后将输出的内容添加到你的 PowerShell Profile 中:

notepad $PROFILE

Bash/Zsh

mg init --shell bash
# 或
mg init --shell zsh

然后将输出的内容添加到 ~/.bashrc~/.zshrc 中。

配置文件

配置文件存储位置:

  • Windows: %APPDATA%\mg-git-cli\config.json
  • macOS/Linux: ~/.config/mg-git-cli/config.json

示例

# 1. 设置代理
mg config set proxy=http://127.0.0.1:7897

# 2. 设置仓库目录
mg config set repos-path=D:/workspace

# 3. 克隆仓库
mg clone https://github.com/user/project.git

# 4. 查看状态
mg status

# 5. 初始化 shell 集成后切换目录
mg-cd project

# 6. 拉取/推送代码
mg pull
mg push

项目结构

mg-git-cli/
├── bin/
│   └── mg.js              # CLI 入口
├── lib/
│   ├── commands/
│   │   ├── pull-push.js   # pull/push 命令
│   │   ├── clone.js       # clone 命令
│   │   ├── cd.js          # cd 命令
│   │   ├── status.js      # status 命令
│   │   └── config.js      # config 命令
│   ├── config.js          # 配置管理
│   ├── git-executor.js    # Git 执行器
│   └── index.js
├── package.json
└── README.md

License

MIT