Skip to content

Instantly share code, notes, and snippets.

@zivni
Last active September 24, 2019 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zivni/90a6a93fec678821ecc58f62742f7b8f to your computer and use it in GitHub Desktop.
Save zivni/90a6a93fec678821ecc58f62742f7b8f to your computer and use it in GitHub Desktop.
some useful git aliases
git config --global alias.alias "config --get-regexp ^alias\."
git config --global alias.incoming '!git fetch && git log --pretty=format:"%C(yellow)%h\\ %ad\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short ..$1'
git config --global alias.mincoming '!git fetch && git log ..origin/master'
git config --global alias.outgoing 'cherry -v'
git config --global alias.l 'log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short'
git config --global alias.master 'checkout master'
git config --global alias.graph 'log --oneline --abbrev-commit --all --graph --decorate --color'
git config --global alias.view 'show --oneline --name-status'
git config --global alias.mine '!git log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | grep -F $(git config user.name) | less -r'
@zivni
Copy link
Author

zivni commented Feb 5, 2018

About git alias

Git alias lets you set a short command name to some other complex git commands.

Description

  • git alias - Show the configured aliases.

  • git incoming origin/master - Show what commits are about to be pulled from any branch.

  • git mincoming - Show what commits are about to be pulled from origin master (Shortcut for the above).

  • git outgoing or git outgoing branch_name - Shows what commits are not yet merged.

  • git l - Log the commits as one liners.

  • git master - Shortcut to checkout master.

  • git graph - show log as graph.

  • git view d1592b88 - show files in a commit.

  • git mine - show your commits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment