Command-Line Interface
Git Information
-
Git version:
git version 2.35.1.windows.2 -
Git remote server:
GitHub -
Active branch:
main -
Git status:
cli.html was initially untracked
Reference Guide
Git Commands
| 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
|
|
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. |