Skip to main content
Dev · 283 tools

Git Alias Generator

Suggests useful Git aliases that speed up your command-line workflow

Git AliasesExample — click Generate for yours
  • git config --global alias.lola "log --graph --decorate --pretty=oneline --abbrev-commit --all" # compact log all
  • git config --global alias.review "!gh pr view --web" # open PR in browser
  • git config --global alias.pushtags "push --tags" # push all tags
  • git config --global alias.pump "!f() { git commit --allow-empty -m \"$1\"; }; f" # empty commit with msg
  • git config --global alias.whoami "config user.email" # show your git email
  • git config --global alias.trackremote "!git branch --set-upstream-to=origin/$(git rev-parse --abbrev-ref HEAD)" # track same-name remote

Generated 6 items

See 3 examples
  • Example 1
    git config --global alias.lola "log --graph --decorate --pretty=oneline --abbrev-commit --all"   # compact log all
    git config --global alias.review "!gh pr view --web"   # open PR in browser
    git config --global alias.pushtags "push --tags"   # push all tags
    git config --global alias.pump "!f() { git commit --allow-empty -m \"$1\"; }; f"   # empty commit with msg
    git config --global alias.whoami "config user.email"   # show your git email
    git config --global alias.trackremote "!git branch --set-upstream-to=origin/$(git rev-parse --abbrev-ref HEAD)"   # track same-name remote
  • Example 2
    git config --global alias.sl "stash list"   # list stashes
    git config --global alias.summary "!git log --oneline | wc -l"   # count commits
    git config --global alias.serve-http "!git instaweb --httpd=webrick --start"   # serve repo browser
    git config --global alias.dump "cat-file -p"   # show git object contents
    git config --global alias.diffstat "diff --stat"   # summary diff
    git config --global alias.nuke "!git clean -fd && git checkout -- ."   # remove untracked + reset tracked
  • Example 3
    git config --global alias.autofix "!git fetch && git rebase origin/main --autostash"   # rebase and stash
    git config --global alias.trigger "!git commit --allow-empty -m \"chore: trigger ci\" && git push"   # empty commit to kick CI
    git config --global alias.tag-latest "describe --tags --abbrev=0"   # latest reachable tag
    git config --global alias.wipeuntracked "clean -fd"   # remove untracked files/dirs
    git config --global alias.rename-branch "branch -m"   # rename current branch
    git config --global alias.pushup "!git push -u origin $(git rev-parse --abbrev-ref HEAD)"   # push and set upstream

About this generator

Git commands that developers type dozens of times a day — checkout, status, log, commit — are long enough to slow down a workflow when multiplied across a workday. This generator suggests useful aliases as ready-to-run git config --global commands that you paste into your terminal once to register the shortcut permanently. Each alias is immediately available in every repository on your machine after running it. There is one input: the count, from 1 to 20. The generator draws from a fixed pool of 262 curated aliases covering commonly needed shortcuts: co for checkout, st for status -sb, lg for a one-line decorated log graph, amend for commit --amend --no-edit, undo for reset HEAD~1 --mixed, pushf for push --force-with-lease, dc for diff --cached, take for checkout -b, and many others. Because each run draws randomly without replacement, you get a varied set of distinct aliases rather than duplicates. Paste the aliases you want directly into your terminal. To see all the aliases you have configured at any time, use git config --get-regexp ^alias\. or set up the included aliases alias to make that a one-word command.

How to use

  1. Choose how many alias suggestions you want.
  2. Click Generate to produce a list of git config commands.
  3. Paste the ones you like into your terminal to register them.
  4. Start using the short aliases in any repository.

Use Cases

  • •Speeding up a daily Git command-line workflow
  • •Discovering useful shortcuts you did not know about
  • •Setting up a new development machine quickly
  • •Sharing a recommended alias set with a team
  • •Learning common Git command patterns

Tips

  • →Pick aliases for the commands you actually run most, not every option.
  • →Use --force-with-lease rather than --force for a safer force push.
  • →List your aliases with the aliases shortcut when you forget one.
  • →Share a team alias set so everyone benefits from the same shortcuts.

FAQ

what is a git alias

A Git alias is a custom shortcut for a longer Git command — for example, setting alias.co to checkout lets you type 'git co' instead of 'git checkout'. Aliases are stored in your Git config and save keystrokes on the commands you run most often.

how do I add a git alias

Run the generated git config command, which registers the alias globally in your Git configuration. For example, 'git config --global alias.st "status -sb"' makes 'git st' run a short-format status. The alias is then available in every repository on your machine.

how do I see my existing aliases

Run 'git config --get-regexp ^alias\.' to list every alias you have defined. This is handy for reviewing what you have set up, and it is itself a popular alias to add so you can recall your shortcuts at any time.

how many aliases are in the pool and can I get duplicates

The generator draws from a fixed pool of 262 aliases without replacement, so you will not receive duplicates within a single run. Each run returns up to 20, the maximum count. Regenerating gives a different random selection from the same pool.

You might also like

Popular tools from other categories that share themes with this one.