Skip to main content

Enhanced git workflow utilities with smart conflict resolution and branch management

Project description

More GIT

Some git shortcuts for better workflow management.

Installation

pip install mo-git

Verify Installation

hit --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.

hit 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.

hit 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:

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

Or create from a specific base branch:

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

Create an alias for an existing branch:

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

Or create an alias for the current branch:

hit alias --as <short name>

Then checkout using the alias:

hit 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
hit checkout -b feature/new-feature

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

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

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

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

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

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

# Create alias for current branch
hit 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/mo-git.git
cd mo-git

# 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 hit 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.705.26062.tar.gz (10.7 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.705.26062-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_shortcuts-1.705.26062.tar.gz
  • Upload date:
  • Size: 10.7 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.705.26062.tar.gz
Algorithm Hash digest
SHA256 caf049e4c1831762cb782032d1e21b066ed69bd81c4c3a214195cca1f1db0c23
MD5 e7598a08dffc34c349feb3263946ba46
BLAKE2b-256 80b67cc778e97e1c5a94b9a02b90f28e542e4905feeb0d282b742435f3731c49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for git_shortcuts-1.705.26062-py3-none-any.whl
Algorithm Hash digest
SHA256 a6b90054ff97a2c5b7b3edaa92c67c421b1107eadd7411a4d17f3e3c7d0bbbba
MD5 0cb03423aac8f23955b5dcb48312dfc9
BLAKE2b-256 60d92bd4f883b97fb108bf17f863da54b5562f996de44df563ae5ae2e5ba1ae0

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