Terminal Navigation — Windows 10
A Git Bash Cheat Sheet
As a windows user (OMG — they do exist), one of the largest hurdles I’ve had to overcome were the lack of useful windows-oriented terminal resources available to our coding community. Sure, we could all dish out some serious cash on a mac, or we could setup a virtual machine that would allow us to run a virtual Mac / Linux — but then, you wouldn’t be here if you could do that. After working on Git Bash for a few months now, I’ve found some easy-to-use customization techniques to help make working on the terminal a more pleasant experience.
If you’re running the Git Bash terminal on your windows machine, you can customize common commands by adding them to your shell script. This will save you time, and help you create a sleek machine that functions on simple commands. To do this, you will need to open your terminal and make sure you are in the home directory (not sure if you’re in the home directory? Type
cd and you will be sent back home no matter where you have navigated to).
Once you are in the home directory, you will need to create your shell script by typing
touch .bashrc. Once you have created your shell script, you will need to edit the document in vim. You can do this by typing the following command
vim .bashrc. From here, you’ll want to press
i to insert your custom commands. Once you’ve pressed
i you can create your custom scripts by typing
alias gs='git status' (in this command, you are basically writing an alias for your terminal to translate your command shortcuts. In this case,
gs will stand for git status). Once you have added in your aliases, you will want to exit the vim and save your shell script. To do this, you will need to press
esc then type
:wq to exit the vim. Once you’ve exited the vim, you can update your changes by typing
source .bashrc. Now, any time you want to run a git status, all you have to do is type
Ever get jealous of all those cool colors and fonts iTerm users have? Well, Git Bash terminals can be changed by navigating to the properties tab after clicking in the top-left corner of the terminal:
Once you’ve selected the properties option, you should see these options:
From here, you can change your color scheme, font types and sizes, as well as general layout to make your terminal a little more beautiful. If you’re looking to add tabs to your terminal — check out this helpful blog post to integrate some other tech.
Commands Not Found
Sometimes, you’ll run a command that should work, and find that the command may not be found. If you’re certain that you’ve downloaded the software onto your computer (PostgreSQL, subl.exe, etc…), it could be that the path needs to be added onto your terminal. If you’re running Windows 10, you will need to right-click the Windows Tab in your taskbar, and select the System option:
Once you have selected System, a new window will appear:
On the left-hand side, select the Advanced system settings. This will open a new window:
In this new tab, you will want to select the Environment Variables button. This will open a new window:
In this new tab, you will need to select the Path under System Variables. Once you have selected the Path, you will need to press the Edit button in order to add a specific file path. When you select the edit button, a new window will appear:
You’re finally ready to add in a new file path. Here you will need to add a new file path to whichever service you are looking to integrate. Once you have done this, press
OK and exit out of the previous windows. Now that your file path is set, you should be ready to go!
- Creating shorter git commands simply requires you to create and modify a Script Shell
- Styling is a built-in functionality for Git Bash, so go crazy
- Adding a File Path onto your Git Bash is easy to setup!