Apply for the next session


Let’s get back into using the terminal (Command Line Interface) a little.

With just a few commands you can create a version-controlled history of your code!

Take notes

Write down any critical concepts and any of the commands – in order of importance.

Command line recap

There are some commands you’ll need. Remember these?

  1. Terminal

    Print Working Directory


    Prints the current working directory you’re in.

  2. Terminal


    This will list out everything in your current directory.

  3. Terminal Command

    Change directory

    cd directory/path

    This will change your current directory to the provided path.

  4. Terminal

    Make Directory

    mkdir folder-name

    Makes a directory (aka folder) inside of whatever directory you are currently in.

Git commands

Here we go.

These are the commands you’ll need for today. Did we miss any?

  1. Terminal

    git version

    git --version

    Checks which version of git you have. Also useful to check and see if you have git installed at all.

  2. Terminal

    git init

    git init

    Initialize your current directory as a git repository.

  3. Terminal

    Change name of branch

    git branch -m nameofbranch

    Changes the name of your current branch. “main” is the current convention being used in 2022, so if your branch is initialized with a name other than “main” you can change it by using the command: git branch -m main.

  4. Terminal

    Check status of git repo

    git status

    Checks the current status of your git repository. Any changes to the folder will be shown.

  5. Terminal

    Add changes to staging area

    git add file-path/filename.extension

    This will add any of the changes on the file to the staging area.

  6. Terminal

    Commit files

    git commit --message "commit message here"

    This will commit any of the changes of your files with the associated message. You can also use the short-hand -m instead of --message.

  7. Terminal

    Check git commit history

    git log

    Display all past commits.

Some global settings

You’ll probably want to do these things at some point, but don’t get too tripped up by them today. If you get tripped up, give us a call and let’s go over it.

  1. Terminal

    Configure git user

    git config --global "username here"
    git config --global

    These two commands will configure your username and email address for all of your commits.

  2. Terminal

    Change default initial branch name globally

    git config --global init.defaultBranch nameofbranch

    Whatever branch name you chose when entering this command will be the name of the initial branch whenever you initialize a git repository.

Apply for the next session