explaingit

frostming/legit

5,693PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

A command-line tool that wraps Git with simpler everyday commands, automatically stashing uncommitted work when switching branches and combining fetch, merge, and push into a single step.

Mindmap

mindmap
  root((Legit))
    Core commands
      sw branch switch
      sync fetch merge push
      publish branch
      undo last commit
    Smart features
      Auto-stash on switch
      Verbose mode
      Fake preview mode
    Git integration
      Install as aliases
      Shows raw Git commands
    Installation
      pip install
      Homebrew
      Windows exe
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Switch Git branches without manually stashing uncommitted changes first

USE CASE 2

Sync your branch with the remote, fetch, merge, push, and unstash, in one command instead of four

USE CASE 3

Set up git sw and git sync as native Git aliases so they work like built-in Git subcommands

USE CASE 4

Use the --verbose flag to learn which Git commands run under the hood for each Legit action

Tech stack

PythonGit

Getting it running

Difficulty · easy Time to first run · 5min

In plain English

Legit is a command-line tool that wraps Git with a simpler set of commands designed for everyday workflows. Standard Git is powerful but has a steep learning curve and requires knowing the right combination of commands for common tasks. Legit takes inspiration from the old GitHub for Mac desktop app, which made Git more approachable by handling certain tedious steps automatically. The main commands cover the actions most developers reach for daily. The sw command switches branches and automatically stashes any uncommitted work before switching and restores it afterward, so you never get stuck with Git refusing to switch because you have local changes. The sync command does a stash, fetch, merge or rebase, push, and unstash all in one step, replacing a multi-command sequence with a single word. There are also commands to publish a branch to the remote server, remove it from the remote, and undo the last commit. Legit can optionally install itself as a set of Git aliases, so you can type git sw or git sync as if they were built-in Git subcommands. It also has a --verbose flag that shows the underlying Git commands it runs, which is useful for understanding what is happening or for learning Git itself. A --fake flag lets you preview the commands without actually running them. Installation is straightforward via pip on any platform, via Homebrew on macOS and Linux, or via a standalone Windows executable available on the releases page. No additional dependencies are required beyond Python.

Copy-paste prompts

Prompt 1
I installed Legit. How do I use legit sw to switch branches when I have uncommitted changes?
Prompt 2
How do I run legit sync to pull remote changes and push my local commits in one step?
Prompt 3
How do I install Legit commands as Git aliases so I can type git sw instead of legit sw?
Prompt 4
I want to preview what legit sync will do without actually running it, how do I use the --fake flag?
Open on GitHub → Explain another repo

← frostming on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.