Skip to main content
March 23, 2026/4 min read

Git Command Line Basics

Master Essential Git Commands for Professional Development

Prerequisites for This Tutorial

Class Files Setup

You'll need the Git Class folder with the Hipstirred-website folder accessible on your Desktop. Keep this window open throughout the tutorial.

Terminal Access

Mac users need Terminal.app from Applications > Utilities. Windows users can use Command Prompt or Git Bash.

Basic File Navigation

Understanding how to arrange windows and drag files will help with the graphical approach to navigation.

Command Line Basics

1. Navigate to your Desktop and locate the Class Files > Git Class directory. Ensure the Hipstirred-website folder is visible in your file explorer. Keep this window open—you'll need it for the drag-and-drop technique we'll demonstrate shortly.

2. Access your system's command line interface using the appropriate method for your operating system:

  • Mac: Navigate to Applications > Utilities and launch Terminal.app. This is your gateway to macOS's underlying Unix system.

  • Windows: You have two excellent options. If you're comfortable with the native Windows Command Prompt and prefer its syntax, launch that application. For a more Unix-like experience that's particularly well-suited for Git operations, launch Git Bash—you'll find it as a desktop icon or in the Windows Start menu (often nested within a Git folder).

3. Throughout this tutorial, we'll use "terminal window" as a universal term referring to Terminal, Command Prompt, or Git Bash—regardless of which interface you've chosen.

4. In your terminal window, type cd followed by a single space. The cd command (change directory) is fundamental to command line navigation.

5. While you could manually type the complete file path to your destination folder, there's a more intuitive, visual approach that eliminates typing errors. Arrange your windows so you can simultaneously view both the Hipstirred-website folder and your terminal window—this setup is crucial for the next step.

6. Here's where the magic happens: drag the Hipstirred-website folder directly into your terminal window. The system will automatically populate the full path for you. Your command should now display something similar to this (note that your specific path will vary based on your system configuration and username):

cd /Users/dan/Desktop/Class\ Files/Hipstirred-website

7. Click anywhere in the terminal window to ensure it's active, then press Return (Mac) or Enter (Windows) to execute the navigation command and change to that directory.

8. To verify you've successfully navigated and view the folder's contents, use the directory listing command appropriate for your system:

  • Mac: Type ls and press Return. This Unix command provides a clean list of files and directories.

  • Windows using Git Bash: Type ls and press Enter. Git Bash emulates Unix commands for consistency.

  • Windows using Command Prompt: Type dir and press Enter. This is the traditional DOS command for directory listings.

Terminal Commands by Platform

FeatureMac/LinuxWindows Git BashWindows Command Prompt
List Directory Contentslslsdir
Change Directorycdcdcd
Confirm CommandReturnEnterEnter
Recommended: Git Bash provides Unix-like commands on Windows for consistency

Setting Up Your Terminal Navigation

1

Open Terminal Application

Mac: Applications > Utilities > Terminal.app. Windows: Launch Git Bash or Command Prompt based on preference.

2

Prepare the cd Command

Type 'cd' followed by a space in your terminal window. Don't press Enter yet.

3

Use Drag and Drop Navigation

Arrange windows so you can see both the Hipstirred-website folder and terminal. Drag the folder into the terminal to auto-complete the path.

4

Execute and Verify

Press Return/Enter to navigate to the folder, then use ls (or dir) to confirm you can see the folder contents.

Tip: Bring up Previous Commands

Master this time-saving technique: press the Up Arrow key in any terminal to instantly recall your last executed command. Continue pressing Up Arrow to cycle through your entire command history. This feature is invaluable when you're repeating similar operations or need to modify a previous command slightly. Most modern terminals maintain extensive command histories, sometimes spanning hundreds of previous entries.

Command History Navigation

The Up Arrow key is universal across Mac and Windows terminals. Keep pressing Up Arrow to cycle through your command history - this works in Terminal, Git Bash, and Command Prompt.

Tip: Cancel the Current Command

Everyone makes typing mistakes—it's part of the learning process. When you need to abandon a partially-typed command and start fresh, press Ctrl+C (works on both Mac and Windows). This keyboard shortcut immediately cancels the current input and presents you with a clean command prompt. It's also useful for interrupting running processes that seem stuck or are taking longer than expected.

Essential Terminal Shortcuts

Cancel Current Command

Press CTRL-C on both Mac and Windows to cancel the current command and get a clean command line. This works when you make typing mistakes.

Navigate Command History

Use Up Arrow to access previous commands and Down Arrow to move forward through your command history.

Tip for Mac Users

Mac users enjoy an even more streamlined workflow for directory navigation. With your terminal prompt completely empty (don't type anything), hold the Cmd key and drag any folder directly onto the terminal window. The terminal instantly changes to that directory—no need to press Return or execute any additional commands. This Mac-specific feature leverages the operating system's deep integration between the graphical interface and command line environment.

Mac Power User Shortcut

Hold Cmd and drag any folder onto an empty terminal prompt to instantly navigate to that folder. No need to type cd, no need to press Return - the terminal automatically changes to that directory.

Mac Navigation Methods Comparison

FeatureStandard MethodPower User Method
Steps Required4 steps1 step
Typing RequiredType cd + spaceNo typing
Key CombinationNoneCmd + drag
Confirmation NeededPress ReturnAutomatic
Recommended: Power user method saves significant time for frequent navigation

Go Beyond Git

Ready to expand your technical expertise? We offer a comprehensive curriculum of professional development courses designed for today's competitive tech landscape. Our classes maintain small cohort sizes, emphasize hands-on learning, and are led by industry experts with real-world experience. Explore our current offerings:

Available Course Categories

Web Development Courses

Learn full-stack development with hands-on projects and expert instruction in small class settings.

Python Programming

Master Python fundamentals and advanced concepts through practical coding exercises and real-world applications.

Data Science Training

Develop analytical skills and learn data manipulation, visualization, and machine learning techniques.

Web Design Programs

Create compelling user interfaces and experiences with modern design principles and tools.

Small Class Advantage

All courses feature small class sizes for personalized attention, hands-on learning experiences, and expert-led instruction to ensure comprehensive skill development.

Key Takeaways

1Git command line basics require understanding platform-specific terminal applications: Terminal.app for Mac, Git Bash or Command Prompt for Windows
2The cd command combined with drag-and-drop folder navigation provides a graphical approach to terminal directory changes
3Directory listing commands vary by platform: ls for Mac and Git Bash, dir for Windows Command Prompt
4Up Arrow key universally accesses command history across all terminal applications, significantly improving workflow efficiency
5CTRL-C cancels current commands on both Mac and Windows, providing a quick way to start over when mistakes occur
6Mac users can leverage Cmd+drag shortcut to instantly navigate terminal to any folder without typing commands
7Proper window arrangement allows simultaneous access to file system and terminal for efficient navigation
8Understanding these fundamental commands creates a foundation for more advanced Git operations and version control workflows

RELATED ARTICLES