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

@git-lazy/remote

v2.0.3

Published

@git-lazy/remote

Readme

@git-lazy/remote

Utilities for managing remote Git branches, including renaming capabilities

Installation

npm install @git-lazy/remote
# or
pnpm add @git-lazy/remote
# or
yarn add @git-lazy/remote

Usage

import { renameRemoteBranch } from '@git-lazy/remote';

// 重新命名 origin 上的遠端分支
// Rename a remote branch on origin
const result = renameRemoteBranch('origin', 'feature/old-name', 'feature/new-name');

if (result) {
  console.log('分支重新命名成功 / Branch renamed successfully');
}

// 指定工作目錄執行
// Execute with specified working directory
renameRemoteBranch('origin', 'dev', 'develop', {
  cwd: '/path/to/git/repo'
});

API

renameRemoteBranch(remote, old_name, new_name, options?)

重新命名 Git 遠端分支 / Rename a Git remote branch

此函式透過兩個步驟完成分支重新命名:

  1. 將舊分支推送到遠端的新分支名稱
  2. 刪除遠端的舊分支

This function completes branch renaming through two steps:

  1. Push the old branch to the remote with the new branch name
  2. Delete the old branch from the remote

Parameters:

  • remote (string) - 遠端倉庫名稱(例如 'origin')/ Remote repository name (e.g., 'origin')
  • old_name (string) - 原始分支名稱 / Original branch name
  • new_name (string) - 新的分支名稱 / New branch name
  • options? (IOptions) - 可選配置物件 / Optional configuration object
    • options.cwd? (string) - Git 倉庫的工作目錄路徑,預設為 process.cwd() / Working directory path of the Git repository, defaults to process.cwd()

Returns: boolean | undefined - 操作成功時返回 true,參數驗證失敗時返回 undefined / Returns true on success, undefined on validation failure

Example:

import { renameRemoteBranch } from '@git-lazy/remote';

// 基本用法
const result = renameRemoteBranch('origin', 'feature/old', 'feature/new');

// 指定工作目錄
renameRemoteBranch('upstream', 'main', 'master', {
  cwd: '/path/to/repo'
});

renameRemoteBranch.IOptions

重新命名遠端分支的配置選項介面 / Configuration options interface for renaming remote branch

Properties:

  • cwd? (string) - Git 倉庫的工作目錄路徑,會自動解析為真實路徑 / Working directory path of the Git repository, resolved to real path automatically

Example:

const options: renameRemoteBranch.IOptions = {
  cwd: '/path/to/git/repo'
};

renameRemoteBranch('origin', 'dev', 'develop', options);

Dependencies

  • @git-lazy/util - Git 工具函式庫 / Git utility library
  • @lazy-spawn/stringify - 命令輸出字串化 / Command output stringification
  • tslib - TypeScript 輔助函式 / TypeScript helpers

License

ISC