Setting Up Git Bash in Positron (Windows)
1. Install Git for Windows
To get a Linux/Mac-style command line on Windows, you need to install Git Bash.
Option A:
- In the terminal enter:
winget install --id Git.Git -e --source wingetand follow the prompts
Option B: 1. Go to the official website: https://git-scm.com. 2. Click “Click here to download” to get the latest 64-bit standalone installer. 3. Open the downloaded .exe file to start the setup wizard. 4. Click Next through the prompts. Most defaults are perfect, but ensure the following are checked: * Choosing the default editor: You can leave this as Vim, or switch it to VS Code/Notepad if preferred. * Adjusting your PATH environment: Ensure “Git from the command line and also from 3rd-party software” is selected (this is the default). 5. Click Install, then click Finish once it completes.
2. Set Git Bash as Default in Positron
Now, configure Positron to open Git Bash automatically instead of PowerShell.
- Open Positron.
- Open the Command Palette using the keyboard shortcut:
Ctrl + Shift + P
- Type
Terminal: Select Default Profileinto the search bar and press Enter. - A dropdown menu will appear at the top of the screen. Select Git Bash from the list.
- Open a new terminal to test it:
- Press
(Control + Backtick)or go toTerminal -> New Terminal. - You should see a green/purple prompt ending with a
$symbol.
- Press
4. Core Command Translation Cheat Sheet
Git Bash allows you to use standard Unix syntax directly on Windows. Use this guide to practice your command-line techniques:
| Goal | Mac / Linux / Git Bash | Windows PowerShell | What it Does |
|---|---|---|---|
| List Files | ls or ls -la |
Get-ChildItem |
Shows everything in the current folder |
| Change Folder | cd path/to/folder |
Set-Location |
Moves you to a new directory |
| Print Location | pwd |
Get-Location |
Prints the full path of your current folder |
| Make Folder | mkdir new_project |
New-Item -Type Directory |
Creates a brand new directory |
| Create File | touch script.R |
New-Item script.R |
Creates an empty file |
| View File | more data.csv |
Get-Content data.csv |
Dumps the file contents into the terminal |
| Search Text | grep "tidyverse" script.R |
Select-String |
Finds specific words inside a file |
| Clear Screen | clear |
Clear-Host or cls |
Cleans up a messy terminal screen |
| Open File | open page.html |start page.html` |
Opens a file in the default program |
5. Key Windows Tips for Mac/Linux Users
- The Control Key: Windows uses
Ctrlinstead ofCommand. To copy text in the terminal, useCtrl + Shift + C. To cancel a running command, pressCtrl + C. - Case Insensitivity: Windows does not care about capital letters in file names.
data.csvandDATA.CSVare treated as the exact same file. - File Paths in R: While Windows naturally uses backslashes (
\), Git Bash translates standard forward slashes (/) seamlessly. Always use forward slashes when writing R scripts (e.g.,read.csv("data/my_data.csv")) so your code works perfectly on both Windows and Mac!
6. Clone the Repository
Get the course materials by cloning the GitHub repository. In the terminal, type:
git clone https://github.com/joshtanga/dataviz-R.git