Git Command Line Basics

Git Tips & Commands

While there is a lot you can do via the command line interface, the main thing you need to know how to do for Git is to navigate to a folder.

Command Line Basics

1. On your Desktop, go into the Class Files > Git Class. Make sure you can see the Hipstirred-Website folder. Keep this window open.

2. To access the command line, do the following instructions for your platform:

  • Mac: Go to Applications > Utilities and open

  • Windows: If you're already familiar with the Windows Command Prompt and prefer it, launch that app. Otherwise, launch Git Bash, which may be an icon on your Desktop, or in the Windows Start menu (possibly in a Git folder).

3. Please note that from now on when we say terminal window, we are generically referring to the Terminal, Command Prompt, or Git Bash window.

4. In the terminal window, type cd and a space.

5. While we could type out the file path to the folder we want to navigate to, let's see a more graphical approach. Arrange the windows so you can see the Hipstirred-Website folder and the terminal window at the same time.

Full-Stack Web Development Certificate: Live & Hands-on, In NYC or Online, 0% Financing, 1-on-1 Mentoring, Free Retake, Job Prep. Named a Top Bootcamp by Forbes, Fortune, & Time Out. Noble Desktop. Learn More.

6. Drag the Hipstirred-Website folder into the terminal window and it should type out the path for you. Your command should now read something like (your path will vary based on your computer and terminal app):

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

7. Click on the terminal window and hit Return (Mac) or Enter (Windows) to navigate to that folder. 8. To see the contents of this folder, use the following command:

  • Mac: Type ls and hit Return.

  • Windows using Git Bash: Type ls and hit Enter.

  • Windows using Command Prompt: Type dir and hit Enter.

Tip: Bring Up Previous Commands

In the terminal, you can press the Up Arrow key to bring up the last terminal command you used. Keep pressing Up Arrow again to flip through your previous commands. This can be a great time saver!

Tip: Cancel the Current Command

As you type a command you may make mistakes. If you want to, you can cancel the current command, press the Ctrl–C (Mac & Windows) and you'll be placed on a new, clean command line.

Tip for Mac Users

There's an even quicker way to navigate the terminal to a specific folder. With your terminal prompt empty (do not type anything in it) hold Cmd and drag a folder onto the terminal. That's it! No need to hit Return or anything else, the terminal will have changed to that folder and you're ready to go!

Go Beyond Git

We offer a full suite of coding courses. Classes are small, hands-on, and expert-led. Check out our coding bootcamps and courses now:

How to Learn Git

Master Git with hands-on training. Git is a free, open-source version control system that allows developers to track the changes they make to code.

Yelp Facebook LinkedIn YouTube Twitter Instagram