How to set aliases in the Git Bash for Windows?

后端 未结 8 1770
渐次进展
渐次进展 2021-01-29 19:34

How to alias command in Git Bash for Windows downloaded from git-scm.com ?

I mean Bash commands not Git.

(windows7)


Edit:

Writing aliases i

8条回答
  •  悲&欢浪女
    2021-01-29 20:12

    Follow below steps:

    1. Open the file .bashrc which is found in location C:\Users\USERNAME\.bashrc

      If file .bashrc not exist then create it using below steps:

      1. Open Command Prompt and goto C:\Users\USERNAME\.
      2. Type command notepad ~/.bashrc
        It generates the .bashrc file.
    2. Add below sample commands of WP CLI, Git, Grunt & PHPCS etc.


    # ----------------------
    # Git Command Aliases
    # ----------------------
    alias ga='git add'
    alias gaa='git add .'
    alias gaaa='git add --all'
    
    # ----------------------
    # WP CLI
    # ----------------------
    alias wpthl='wp theme list'
    alias wppll='wp plugin list'
    

    Now you can use the commands:

    • ga instead of git add .
    • wpthl instead of wp theme list

    Eg. I have used wpthl for the WP CLI command wp theme list.

    Yum@M MINGW64 /c/xampp/htdocs/dev.test
    $ wpthl
    +------------------------+----------+-----------+----------+
    | name                   | status   | update    | version  |
    +------------------------+----------+-----------+----------+
    | twentyeleven           | inactive | none      | 2.8      |
    | twentyfifteen          | inactive | none      | 2.0      |
    | twentyfourteen         | inactive | none      | 2.2      |
    | twentyseventeen        | inactive | available | 1.6      |
    | twentysixteen          | inactive | none      | 1.5      |
    | twentyten              | inactive | none      | 2.5      |
    | twentythirteen         | inactive | none      | 2.4      |
    | twentytwelve           | inactive | none      | 2.5      |
    

    For more details read the article Keyboard shortcut/aliases for the WP CLI, Git, Grunt & PHPCS commands for windows

提交回复
热议问题