'create git alias for `git log --all --decorate --graph --oneline`

I use the command git log --all --decorate --graph --oneline very often and I want to create an git alias for --all --decorate --graph --oneline.

I tried with git config --global alias.adgo "--all --decorate --graph --oneline", but when I typed git log adgo afterward, an error message was displayed, saying "fatal, ambiguous argument adgo".

Could someone tell how to get this git alias working? I have been struggling for a while now. Appreciate any help!



Solution 1:[1]

You need to define it as

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

then use it as

git adgo

Solution 2:[2]

You are trying to set like this:

git config --global alias.adgo "--all --decorate --graph --oneline"

Have to run this:

git config --global alias.adgo "log --all --decorate --graph --oneline"

Now try running this command

git adgo

The one who have taught you git didn't told you that this is the right way to set an alias:

git config --global alias.<alias> "<cmd> <options>"

HOPE THIS ANSWER HELPED!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gwyn Evans
Solution 2