If you are using Git Bash on Windows and you're used to Linux bash commands, chances are that you'd like to add aliases that help making your jobs easier.
These two are my favorite aliases:
$ alias cll='clear; ls -lah'
$ alias countFiles='ls -1 | wc -l'
How to add an alias permanently for the Git Bash
To add an alias permanently, you'd need to edit the file
/C/Program Files/Git/etc/profile.d/aliases.sh .Run your text editor as an administrator and open that file.
Add your alias and save the file.
Open the Git Bash. Execute 'alias', and you're done. Have fun.
$ alias
alias cll='clear; ls -lah'
alias countFiles='ls -1 | wc -l'
alias ll='ls -lah'
alias ls='ls -F --color=auto --show-control-chars'
Oldest comments (13)
Dude, you're a lifesaver.
Thank you. That is a great help :)
Tks, dude! It really helped me 😁
Exactly what I was looking for, thanks!!
thanks for this.
a little thing to note is this works while navigating in bash
cd /c/'Program Files'/Git/etc/profile.d
not
cd /c/Program Files/Git/etc/profile.d as this one won't work in bash
Note: place the equal sign ('=') immediately after the alias without any spaces.
Examples:
alias k = 'kubectl' // not working
alias k= 'kubectl' // working
I always use
ll
withthanks for this, my workflow thanks you ❤️
Aliases can be created using git config command as well, without actually opening the git files.
also to note: my
git
installation was in theAppData
folder, so my path looked like this:thanks a lot.
also worked multi-line alias like this:
Great little bit of advice! Totally worked for me. Thank you. :D
so helpful, thanks