Reputation: 1704
I have created a goToProject.bat file with this content:
cd C:\Dev\MyProject
I want to run the goToProject.bat using Git Bash because i don't want to manually go to the folder every time i have to use git in my project.
To run the goToProject.bat from Git Bash i can do that:
$cmd goToProject.bat
Doing this the goToProject.bat runs but the console transforms to the windows cmd console and if i do:
c:\Dev\MyProject> exit
The console transforms again to Git Bash console but in the default route.
How i can run the goToProject.bat and stay in the Git Bash console?
Upvotes: 2
Views: 6896
Reputation: 1704
I already found what I needed:
To open git bash directly from visual studio without having to manually type the project root folder every time, just add a new external tool command:
In Visual Studio Menu Bar: Tools -> External Tools -> Add New
Title: Git Bash
Command: c:\Program Files (x86)\git\bin\sh.exe
Args: --login -i
Initial Dir: $(SolutionDir)
Doing this, you can search 'Git Bash' under 'Tools' on the Visual Studio Menu Bar and git bash will be opened within your project folder.
Also, you can set a shortcut to your external tools:
Upvotes: 4
Reputation: 3659
Just write up a .sh script instead of a .bat file.
Here's more info: GIT Bash - how to default to other directory instead of home directory
Upvotes: 1