DevTools Logo

Git Alias & Config Builder

Git Alias & Config Builder

Pick proven aliases and core settings, then copy a valid ~/.gitconfig snippet or git config commands.

Runs in your browser
Try an example

Alias catalog & settings

5 alias(es), 3 setting(s)

30 matching aliases

Status & log
  • stShort branch-aware status
    status -sb
  • sFull status
    status
  • lgCompact graph of every ref
    log --oneline --decorate --graph --all
  • lOne line per commit
    log --oneline --decorate
  • lastInspect the latest commit
    log -1 HEAD --stat
  • histDate-ordered history graph
    log --oneline --graph --date-order --all --decorate
Commit & undo
  • coShorter checkout
    checkout
  • ciShorter commit
    commit
  • amendAmend without an editor
    commit --amend --no-edit
  • undoUndo the last commit, keep changes staged
    reset --soft HEAD~1
  • unstageUnstage a file without changing it
    reset HEAD --
  • wipSnapshot everything as WIP
    !git add -A && git commit -m "WIP"
Branch & merge
  • brList local and remote branches
    branch -a
  • bList local branches
    branch
  • syncFetch, prune and fast-forward
    !git fetch --all --prune && git pull --ff-only
  • publishPush the current branch with tracking
    !git push -u origin HEAD
  • bnCreate and switch to a branch
    !f() { git checkout -b "$1"; }; f
  • mgKeep a merge commit
    merge --no-ff
Rebase helpers
  • rbInteractive rebase
    rebase -i
  • rbaAbort an in-progress rebase
    rebase --abort
  • rbcContinue an in-progress rebase
    rebase --continue
  • autosquashFold fixup commits automatically
    rebase -i --autosquash
  • fixupCreate a fixup commit for a commit
    !f() { git commit -a --fixup="$1"; }; f
One-liners
  • ignoreIgnore a path locally only
    !f() { echo "$1" >> .git/info/exclude; }; f
  • rootsPrint the repository root
    rev-parse --show-toplevel
  • currentPrint the current branch
    rev-parse --abbrev-ref HEAD
  • remotesList remotes and URLs
    remote -v
  • tagsList tags with messages
    tag -n
  • diffstatDiffstat of working changes
    diff --stat
  • cleanupDelete merged local branches
    !git branch --merged | grep -v '\*' | xargs -r git branch -d
Custom alias
Common settings
Other setting
Import existing config

Generated config

.gitconfig snippet

No validation issues — output is INI-valid.

Examples

Short status

Input
st = status -sb
Output
st = "status -sb"

The most common alias: branch-aware, short status in one command.

Fixup function

Input
!f() { git commit --fixup="$1"; }; f
Output
fix = "!f() { git commit --fixup=\"$1\"; }; f"

The trailing '; f' invokes the function; without it the alias is a silent no-op.

Command list

Input
init.defaultBranch = main
Output
git config --global init.defaultBranch 'main'

Command mode emits one shell-safe command per key for setup scripts.

About this tool

Git Alias & Config Builder turns a curated alias catalog and a handful of common settings into a ready-to-paste ~/.gitconfig snippet. Every alias is explained in one line so you know what it does before adding it.

The builder escapes values using git's INI rules: backslashes and double quotes are preserved, newlines are rejected, and shell aliases that start with ! are flagged with POSIX shell and zsh advisories. Function-form aliases are checked for the trailing '; f' invocation.

Choose a preset, search the catalog, add your own aliases and settings, then export either a commented file snippet or a list of POSIX-quoted git config --global commands. You can import an existing [alias] section back into the editor to revise it.

What this tool does not do

  • Only global config is modeled; repository-local .git/config and include files are out of scope.
  • The registry covers common single-value keys; unknown keys are preserved but flagged rather than auto-corrected.
  • Shell advisories assume /bin/sh for git aliases; zsh-specific globbing and PowerShell quoting require manual review.
  • Import handles [alias] and simple section/key pairs; advanced git config syntax such as multi-value keys and [include] is not represented.

How to use this tool

  1. Start from a preset

    Minimal, Graph lover and Rebase workflow apply a proven set of aliases and settings in one click.

  2. Search and toggle

    Filter the catalog by name, command or effect and tick the aliases you want in your config.

  3. Add custom entries

    Enter a lowercase alias name and its git command, or a key/value pair for a setting outside the catalog.

  4. Review warnings

    Duplicate names, unknown keys, overridden built-ins and quoting problems appear above the output.

  5. Copy or download

    Switch between a .gitconfig snippet and git config commands, then copy or download the result.

Use cases

New machine setup

Rebuild your global config from a preset instead of hunting for an old gist.

Team baseline

Share one snippet or command list so every developer starts with the same aliases.

Workshop starter

Hand students a commented config that explains each alias as they learn git.

Config cleanup

Paste an existing [alias] section, remove entries you no longer use and re-export.

Output and quoting rules

InputEmitted config
st = status -sbst = "status -sb"
!f() { …; }; f!f() { …; }; f with escaped inner quotes
Value with a backslashBackslash doubled
Alias name with a dotRejected
git config --global modegit config --global alias.st 'status -sb'

Alias names accept lowercase letters, digits and dashes only. Multi-line values are not valid in git config.

Common mistakes

Mistake:Writing !f() { …; } without the trailing '; f'.

Fix:Add '; f' so the shell actually calls the function; otherwise it exits silently.

Mistake:Using dots in alias names such as st.2.

Fix:Use letters, digits and dashes only — git treats a dot as a subsection separator.

Mistake:Pasting a multi-line alias into a config value.

Fix:Keep the command on one line; git INI values cannot contain literal newlines.

Mistake:Storing tokens in aliases or settings.

Fix:Keep secrets in a credential manager; the builder flags token-shaped values.

Frequently asked questions

What does the leading ! mean in a git alias?

It tells git to run the value as a shell command instead of as a git subcommand. Plain aliases such as st = status -sb are handled by git itself, while !aliases are passed to /bin/sh, so shell quoting matters.

How do I pass arguments to a git alias?

For git-only aliases just add the arguments after the alias — git appends them to the command. For shell aliases, use a function form such as !f() { git commit --fixup="$1"; }; f, where "$1" refers to the first argument.

Should I use a function-form alias?

For anything that needs arguments, pipes or conditionals, yes. A function form keeps expansions predictable and avoids the quoting pitfalls of long !one-liners. The builder warns if you define a function but forget to invoke it with '; f'.

Gitconfig snippet vs git config --global — which should I run?

Use the snippet when you want to paste a whole section into ~/.gitconfig or commit it to a dotfiles repository. Use the command list when you want one command per key, for example in a setup script or a fresh machine bootstrap.

Where does the global config file live?

Usually ~/.gitconfig on macOS and Linux, and C:\Users\<you>\.gitconfig on Windows. You can confirm the location with git config --global --list --show-origin or set GIT_CONFIG_GLOBAL to another path.

Can alias names contain dots or uppercase letters?

No. Git config subsection names allow alphanumerics and dashes; a dot changes the key structure. The builder normalizes names to lowercase and rejects dots rather than emitting config that git cannot parse.

Does the tool read or change my real git config?

No. Everything happens in the browser tab: nothing is read from your machine and nothing is executed. The output is inert text that you choose to copy or download.

References & standards