Create an Alias ​​Git Bash Windows 10

How to create an alias for Git Bash in Windows 10? I need to create an alias for the long path to my project folder, so I do not need to enter it again and again each time bash is opened. I searched for the answers and tried a few "correct answers", but so far no one has worked.

They include: create .bashrc, or some people suggest .bashrc.(after creating this file I can’t do anything about it. Windows says

Could not find this item. It is no longer in C: \. Check the location of the item and try again.

) echo alias='<path>' > .bashrc(I also tried →)

I can edit the file .bashrcand add aliases there, but none of them work. I tried editing the file .gitconfigin my home folder [alias] = ''

The same result when I type cd <alias name>::

No such file or directory

All I have to do is type: cd and this will lead me to ~ /// ...

+8
source share
2 answers

Try the following:

  • Open a bash terminal
  • cd ~
  • vi.bashrc
  • click ito enter edit mode and update it with the alias command.
  • click Escand click :wq(save and exit)
  • close and reopen bash terminal
  • check the alias command.

, .bash_profile

if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
+11

aliases.sh, git

C:\, Git\etc\profile.d\aliases.sh

notepad++

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

.

git bash

,

MyProjectName

Bash .

,

cd MyProjectName
0

Source: https://habr.com/ru/post/1683253/


All Articles