Command-Line Interface

Git Information

Reference Guide

Git Commands

Common Git commands used to manage a local and remote repository
Action Command Example Notes
Determine the installed Git version git --version git version 2.35.1.windows.2 Displays the installed Git version in the terminal.
List branch names git branch * main The active branch is identified with an asterisk.
Determine remote repository URLs git remote -v origin https://github.com/JulianBurnley/12988_lesson-11-practice-activities-JUL2216252.git (fetch)
origin https://github.com/JulianBurnley/12988_lesson-11-practice-activities-JUL2216252.git (push)
Displays the fetch and push URLs connected to the local repository. Credentials should never appear in the URL.
Check the status of files git status
On branch main
Your branch is up to date with 'origin/main'.

Untracked files:
  cli.html

nothing added to commit
Shows modified, staged, and untracked files in the local repository.
Stage a file before committing git add <file> git add css/styles.css Adds the selected file to Git's staging area.
Stage all current changes git add . git add . Stages all new and modified files in the current repository.
Create a commit git commit -m "<message>" git commit -m "Create CLI reference page" Saves the staged changes as a commit with a descriptive message.
Push changes to the remote repository git push git push origin main Uploads local commits to the remote repository.
Pull changes from the remote repository git pull git pull origin main Downloads and integrates changes from the remote repository.
Clone a repository git clone <URL> git clone https://github.com/JulianBurnley/12988_lesson-11-practice-activities-JUL2216252.git Downloads a remote repository and creates a local project folder.