Git aliases assist programmers to define key shortcuts for certain repeated commands, for example, php artisan can be 'pa'. This avoids the need for repetition of commands.
so how do we create aliases in git?
- install git bash
- open your bash
- in the bash terminal run
vim ~/.bash_profile
this will open bash in the home directory or create one if it doesn't exist
- type in your aliases, as many as you like. For example,
alias pa='php artisan'
alias model='php artisan make:model'
alias controller='php artisan make:controller'
- then press 'esc' key. then type ":wq" to close.
- finally restart git bash
- run 'alias ' to list all the aliases
Testing
now, in our terminal we may run the php server:
pa serve
Top comments (0)