How do i create git aliases?



  • git config man page: http://bit.ly/2q0CtBk

    After a while you will be using some git commands a lot. To create some shortcuts you can setup from git aliases.

    Set up an alias for "git status" command.

    $ git config alias.st status
    

    To see the aliases

    $ git config --list
    

    You can alias any git command, it is very powerful and speeds things up. This is another example of looking at logs

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

    Now we can just run this.

    $ git ml
    

    It also becomes part of the git help for example if I type in the wrong command, it provides a suggest.

    $ git mlq
    git: 'mlq' is not a git command. See 'git --help'.
    
    Did you mean this?
    	ml
    

Log in to reply
 

© Lightnetics 2024