Create alias Git Bash Windows 10

Viewed 11922

How to create alias for Git Bash on Windows 10? I need to create an alias of the long path to my project folder so I don't have to type it again and again whenever I open bash. I've searched for answers and tried several "correct answers" but none has worked for me so far.

They include: create a .bashrc or some people suggest .bashrc. (after creating this file, I cannot do anything with it. windows says

Could not find this item This is no longer located in C:\. Verify the item's location and try again.

) echo alias='<path>' > .bashrc (iI've also tried >>)

I can edit the file .bashrc and put aliases in there but none of them works. I've tried editing the .gitconfig file in my home folder [alias] =''

Same result whenever I type: cd <alias name>:

No such file or directory

All I need to do is to type: cd and it will lead me to ~///...

2 Answers

you can also open and edit the file aliases.sh that you find in the installation path of git

C:\path where you installed Git\etc\profile.d\aliases.sh

Open it with atom or notepad++ and add a line like

alias MyProjectName='C:/<installation_path_of_your project>/'

and save.

close and reopen git bash

now if you write

MyProjectName

on Bash, it should automatically bring you tothe desired path.

If it doesn't work try with

cd MyProjectName
Related