Skip to content

Git Alias

Roger Xu edited this page Nov 2, 2016 · 3 revisions

Single Command

$ git config --global alias.logg 'log --oneline --decorate --graph --all'

Run this command

$ git logg

Multiple Commands

We need to fetch the changes from remote repository and remove deleted remote branches in local repository.

Add a Git alias named cleanup in the global configuration file <USER_HOME>/.gitconfig.

[alias]
	cleanup = !git fetch origin && git remote prune origin

Run this command

$ git cleanup

Alias

Graphic log

alias.logg=log --oneline --decorate --graph --all

Checkout

alias.co=checkout

Cleanup

alias.cleanup=fetch --prune origin

ls

alias.ls=log --pretty=format:"%C(yellow)%h %Cgreen%ai%Cred%d %Creset%s %Cblue[%cn]" --decorate

ll

alias.ll=log --pretty=format:"%C(yellow)%h %Cgreen%ai%Cred%d %Creset%s %Cblue[%cn]" --decorate --numstat

Find File

alias.f=!git ls-files | grep -i

Find in Files

alias.gr=grep -Ii

Clone this wiki locally