LinuxCommandLibrary

git-magic

Comprehensive guide to Git and its internals

TLDR

Commit changes with a generated message

$ git magic
copy

[a]dd untracked files and commit changes with a generated message
$ git magic -a
copy

Commit changes with a custom [m]essage
$ git magic -m "[custom_commit_message]"
copy

[e]dit the commit [m]essage before committing
$ git magic -em "[custom_commit_message]"
copy

Commit changes and [p]ush to remote
$ git magic -p
copy

Commit changes with a [f]orce [p]ush to remote
$ git magic -fp
copy

SYNOPSIS

source git-magic
or
. ./git-magic
(Typically sourced in shell config; no direct execution options.)

DESCRIPTION

git-magic is a lightweight Bash/Zsh script popular in developer dotfiles, providing dozens of concise aliases and functions to supercharge Git workflows.

After sourcing it in your shell profile (e.g., .bashrc or .zshrc), common Git operations become faster: g runs git status, ga does git add, gcm commits with a message via git commit -m, gp pushes (git push), gco checks out branches (git checkout), and advanced ones like gap for interactive patching (git add -p), gr for rebasing (git rebase), or gl for pretty logs.

It reduces keystrokes significantly, supports tab-completion, and feels like magic for daily Git use. Download from GitHub repos, customize aliases if needed, and source to activate. Ideal for power users tired of typing full commands.

CAVEATS

Aliases may conflict with existing shell functions or other Git tools (e.g., git-extras). Always review and customize before sourcing. Not an official Git command—community script. Requires Git installed.

KEY ALIASES EXAMPLES

gst: git status
gaa: git add --all
gcm: git commit -m
gp: git push
gco: git checkout
gl: git pull
gb: git branch

INSTALLATION TIP

curl -o git-magic https://raw.githubusercontent.com/.../git-magic
source git-magic

HISTORY

Emerged in early 2010s from developer dotfiles (e.g., inspired by holman/dotfiles, mathiasbynens/dotfiles). Evolved via GitHub forks; no single maintainer but widely copied/adapted for ~10+ years in open-source communities.

SEE ALSO

git(1), bash(1), zsh(1), alias(1)

Copied to clipboard