Skip to main content

Enhanced git workflow utilities with smart conflict resolution and branch management

Project description

Git Shortcuts

Some Git shortcuts for better workflow management.

PyPI Latest Release Build Status Coverage Status Downloads

Installation

You must have git installed and available in your PATH to use this tool.

pip install git-shortcuts

Verify Installation

gscut --help

Usage

Safe checkout

Quickly checkout a branch without worrying about losing work. This is especially useful when you have a lot of uncommitted changes, and you want to switch to another branch to work on something else, but you don't want to lose your changes.

gscut checkout <branch>

Merge without conflicts

Quickly merge a branch without worrying about conflicts. Conflicted files will be added to the repo with the foreign branch name appended to the filename. You can resolve conflicts later by comparing the files and selecting the changes you want to keep.

gscut merge <branch>

Alias branch names

Corporate repositories often have long branch names that are difficult to remember and type. You can create aliases for these branch names to make it easier to work with them.

Create a new branch with an alias:

gscut checkout -b feature/user-authentication --as ua

Or create from a specific base branch:

gscut checkout -b hotfix/security-patch --as hsp --from main

Create an alias for an existing branch:

gscut alias <branch name> --as <short name>

Or create an alias for the current branch:

gscut alias --as <short name>

Then checkout using the alias:

gscut checkout ua

Features

  • Smart Stashing: Automatically stashes changes when switching branches, including untracked files
  • Staged/Unstaged Preservation: Restores files to their exact staged/unstaged state after switching
  • Conflict Resolution: Creates .branch-name copies of conflicted files for easy comparison
  • Branch Aliases: Short aliases for long branch names
  • Flexible Syntax: Arguments can be in any order (e.g., --as alias --from base -b name)

Examples

# Create branch without alias
gscut checkout -b feature/new-feature

# Create branch with alias
gscut checkout -b feature/user-authentication --as ua

# Create from specific base branch
gscut checkout -b hotfix/critical --from production

# All options together (any order)
gscut checkout -b feature/api-v2 --as api2 --from develop
gscut checkout --as api2 --from develop -b feature/api-v2

# Switch to existing branch
gscut checkout main
gscut checkout ua  # using alias

# Merge with automatic conflict resolution
gscut merge feature/new-api

# Create alias for existing branch
gscut alias feature/very-long-branch-name --as vlbn

# Create alias for current branch
gscut alias --as cb

Development Installation

Install in editable mode so changes to the code are immediately reflected:

# Clone the repository
git clone https://github.com/klahnakoski/git-shortcuts.git
cd git-shortcuts

# Install in development mode
pip install -r tests/requirements.txt
pip install -r packaging/requirements.txt
pip-compile packaging/requirements.txt -o packaging/requirements.txt


pip install -e .

This creates a gscut command available system-wide.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_shortcuts-1.708.26066.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_shortcuts-1.708.26066-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file git_shortcuts-1.708.26066.tar.gz.

File metadata

  • Download URL: git_shortcuts-1.708.26066.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for git_shortcuts-1.708.26066.tar.gz
Algorithm Hash digest
SHA256 3423a9844067823676832a3821add58dee65329b8bf3772e192ddc8ba0ad04cd
MD5 49d6572f1318e6fd7d007864e1e53b02
BLAKE2b-256 6fa1f3eeedb6ee400543b8b0dd64483a0890282674ea9cfb310e88f08069a76b

See more details on using hashes here.

File details

Details for the file git_shortcuts-1.708.26066-py3-none-any.whl.

File metadata

File hashes

Hashes for git_shortcuts-1.708.26066-py3-none-any.whl
Algorithm Hash digest
SHA256 cca8284678262e9d510b5bdb3e038d7bd2c9dcbae493983720d1b65d62d06f14
MD5 7417b0f0238d379cf5cd64d0c9984180
BLAKE2b-256 b082f9b1086a308d7fe0a05239d88ed97bd898ff1ddabfc2f2becf849235ad20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page