You’re using the same commands often but they are long or you don’t remember their syntax? I have a solution for you!
Bash Aliases
It’s called bash aliases to do the same thing that you can perform with npm scripts, but with a better DX (Developer Experience):
- create a
.bashrc
at the repo root. - define your aliases, for example:
|
|
Usage
Run source .bashrc
from within the terminal in the repository’s root.
Then, run any alias with it name and use TAB
to list them if you cannot remember one exactly.
To check the aliases are loaded, run alias
in the terminal.
PS: you’ll also have many other predefined aliases in your environment.
To reload the aliases after a change, run source .bashrc
each time.
I’ve tested that in Git bash for Windows. On MacOS or Linux, it works just as well.
Follow me
Thanks for reading this article. Make sure to follow me on X, subscribe to my Substack publication and bookmark my blog to read more in the future.