Skip to content

dingff/gitcut

Repository files navigation

🚀 Gitcut

Gitcut is a streamlined CLI tool that simplifies common Git operations with intuitive commands, making your Git workflow faster and more efficient.

✨ Features

  • 📥 Query - Cherry-pick files from specific branches and repositories
  • 📤 Submit - Quickly commit and push changes with enhanced commit messages
  • 🔀 Branch Handling - Create and manage branches with ease
  • 🍒 Cherry Pick - Interactive cherry-picking from remote branches
  • 🔄 Merge - Interactive branch merging
  • 📊 Stats - View contribution statistics by author

🛠️ Installation

npm install -g gitcut

⚙️ Configuration

Initialize the configuration:

gt --init

This creates a gtconfig.json file in your current directory with default settings:

{
  "query": {
    "main": {
      "remoteUrl": "",
      "branch": "",
      "paths": ["src"]
    }
  },
  "submit": {
    "emoji": false
  }
}

You can customize this file to add your own presets and preferences.

📚 Commands

query

Pull specific files from a remote branch:

gt query <remote> <branch> <paths...>

You can exclude specific paths by prefixing them with !:

gt query origin main src/components !src/components/deprecated

Running without arguments launches interactive mode.

You can also use presets defined in your gtconfig.json:

gt query main

submit

Commit and push changes in one step:

gt submit "feat: add new feature"

Emoji support for commit types can be enabled in the configuration file (gtconfig.json) by setting submit.emoji to true.

When enabled, these emoji prefixes are supported:

  • feat: ✨
  • fix: 🐛
  • docs: 📝
  • style: 🎨
  • refactor: 🔨
  • perf: ⚡️
  • test: ✅
  • chore: 🔧
  • ci: 💚
  • revert: ⏪
  • build: 📦

And you can use gt s as a shorthand for gt submit.

bh (branch handling)

Create and push a new branch:

gt bh feature/new-feature

List remote branches:

gt bh -l

Create branch with interactive prompt:

gt bh

Create branch with emoji:

gt bh -e

cp (cherry pick)

Interactive cherry-picking:

gt cp

mg (merge)

Interactive branch merging:

gt mg

rc (rebase continue)

Simplifies the rebase continue process:

gt rc

stats

View contribution statistics:

gt stats [time-range]

Default time range is 1 week. Examples:

gt stats 2.weeks
gt stats 1.month

📄 License

MIT

About

A CLI tool providing fast and convenient git command shortcuts

Resources

License

Stars

Watchers

Forks

Packages

No packages published