How to alias commands in Git Bash for Windows downloaded from git-scm?
I mean Bash commands, not Git.
I’m on Windows 7.
Edit:
Writing aliases in .bashrc
file (as suggested by @gturri) not adding it in console.(after system reboot)(I have never wrote alias for ls
command so it should be some default alias.)
~/etc $ cat .bashrc
alias ll='ls -l'
alias dupa='ls -l'
~/etc $ dupa
bash: dupa: command not found
~/etc $ ll
total 0
~/etc $ alias
alias ll='ls -l'
alias ls='ls -F --color=auto --show-control-chars'
To configure bash aliases, it's the same as if you were on a Unix platform: put them in a .bashrc
in your home:
cd
echo alias ll=\'ls -l\' >> .bashrc
To have this change taken into account you should then either source this file (ie: run source .bashrc
) or restart your terminal
(In some cases* you can find equivalent for .bashrc
file in C:\Users\<username>\AppData\Local\GitHub\PortableGit_\etc\profile.d\aliases.sh.
And you should add aliases in aliases.sh.
)
(*this case is when you install Git for Windows GUI release from https://git-scm.com/download/win that contains GitBash)