'Git alias to open the git installation folder
I want to create a git alias git dir
, which when used should open the git installation folder via Windows Explorer, how to implement such an alias?
Solution 1:[1]
If using Git Bash, try:
git config --global alias.dir '!start "" "$(git --exec-path)"'
Reference: Can I use the "start" command with spaces in the path?
Solution 2:[2]
Starting an alias with ! treats it as a command.
I don't have a windows machine at hand, but for Linux:
git config --global alias.open '!git --exec-path | xargs xdg-open'
Works as described.
So the command you're looking for will probably look something like:
git config --global alias.open "!git --exec-path | 'sed s~/~\\~g' | xargs explorer"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 |