Git Shortcuts
Some Git shortcuts for better workflow management.
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-namecopies 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.
Metadata
Release files for git-shortcuts 1.708.26066
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| git_shortcuts-1.708.26066.tar.gz | 17.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| git_shortcuts-1.708.26066-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.6 kB
Release files / git_shortcuts-1.708.26066.tar.gz
| Download URL | git_shortcuts-1.708.26066.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3423a9844067823676832a3821add58dee65329b8bf3772e192ddc8ba0ad04cd
|
|
BLAKE2b-256 checksum How to use checksums |
6fa1f3eeedb6ee400543b8b0dd64483a0890282674ea9cfb310e88f08069a76b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Release files / git_shortcuts-1.708.26066-py3-none-any.whl
| Download URL | git_shortcuts-1.708.26066-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cca8284678262e9d510b5bdb3e038d7bd2c9dcbae493983720d1b65d62d06f14
|
|
BLAKE2b-256 checksum How to use checksums |
b082f9b1086a308d7fe0a05239d88ed97bd898ff1ddabfc2f2becf849235ad20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.1
|
Security for git-shortcuts 1.708.26066
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.