'Git bash change into a directory and start a file

My default git bash starts on the C: drive and I often have to change into a project directory and start a file up. Is there a way to cd into a directory and start a file all in one command using Git bash on Windows?



Solution 1:[1]

You should have a file .bashrc into your home directory. It should be under C:\Users\login

  1. Add the following line in the file: cd "projet_directory_full_path"
  2. Open a new session and it should start on your project directory

Solution 2:[2]

Yes, you can directly start with cat command following with complete path using forward slashes as 'cat C:/Users/username/filename' and cd command also works in similar way.

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 Youssef H.
Solution 2 Manroop