When you open a Git Bash shell, it will typically open under your home directory, as indicated by a yellow tilda (~) at the end of the command line.
Side-note tip if you’re new to unix type shells:
~
refers back to your home directory – e.g.C:\users\YourUserName\
under Windows, so enteringcd ~/SomeDirectory
from any location will always change your current dir back toc:\users\SomeDirectory
.
For my part, I’ve got most of my projects and source code under a directory called “source“, and all my git-projects below that again in a directory called repos. This means that each time I open the git shell to do any work, the first thing I need to do is change directory using: cd source/repos/TargetRepo
where TargetRepo would be the name of a given project.
This is not a big deal, but it would be better if I could simplify the process of moving to whichever project I wanted to. I could do just that thanks to this simple solution found on Stack Overflow (new window). I’m expanding slightly on it here so I know I’ll find it if I need it again, and because I’m convinced it can be useful to others too.
Continue reading