0% found this document useful (0 votes)
6 views5 pages

Git Github

This document provides a comprehensive guide to Git and GitHub commands, covering configuration, repository management, staging, committing, and synchronization with GitHub. Key commands include setting user information, initializing repositories, adding files to staging, committing changes, and managing branches. It also includes a quick reference table summarizing essential commands and their meanings.

Uploaded by

Jonah Paulin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Git Github

This document provides a comprehensive guide to Git and GitHub commands, covering configuration, repository management, staging, committing, and synchronization with GitHub. Key commands include setting user information, initializing repositories, adding files to staging, committing changes, and managing branches. It also includes a quick reference table summarizing essential commands and their meanings.

Uploaded by

Jonah Paulin
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

GIT / GITHUB

🔧 Git Configuration
git config --global [Link] "FirstName LastName"

👉 Sets your name in Git (who made the changes).


git config --global [Link] "your-email@[Link]
m"

👉 Sets your email for commits.


git config --global [Link] true

👉 Makes Git output colorful and easier to read.


git config --listgit

👉 Shows all your Git settings.


📁 Starting a Repository
git init

👉 Turns a normal folder into a Git repository (starts Git tracking).


git status

👉 Shows which files are changed, added, or ready to commit.

GIT / GITHUB 1
📦 Staging Files (Preparing files before
saving)
git add <file-name>

👉 Adds one file to staging area.


git add <file1> <file2> <file3>

👉 Adds multiple specific files to staging.


git add .

👉 Adds all files in the folder to staging.


git add --all

👉 Adds all changes (new, modified, deleted files).


git add -A

👉 Same as --all (adds everything).

git rm --cached <file-name>

👉 Removes file from Git tracking but keeps it in your computer.


git reset <file-name>

👉 Removes file from staging area (undo git add ).

💾 Committing (Saving snapshot)


GIT / GITHUB 2
git commit -m "add three files"

👉 Saves staged files with a message.


git reset --soft HEAD^

👉 Undo last commit but keep files staged.


git commit --amend -m "enter your message"

👉 Edit the last commit message or add more files to it.


☁️ Pulling and Pushing (GitHub connection)
git remote add origin <link>

👉 Connects your local repo to GitHub repo.


git push -u origin master

(or main)
👉 Uploads your code to GitHub for the first time.
git clone <link>

👉 Downloads a GitHub repository to your computer.


git pull

👉 Gets latest changes from GitHub to your computer.

GIT / GITHUB 3
🌿 Branching (Working on different
versions)
git branch

👉 Shows all branches.


git branch <branch-name>

👉 Creates a new branch.


git checkout <branch-name>

👉 Switches to another branch.


git merge <branch-name>

👉 Combines another branch into current branch.


git checkout -b <branch-name>

👉 Creates and switches to a new branch at the same time.


Super Simple Summary
Command Meaning
git init start Git
git status check changes
git add prepare files
git commit save changes
git push upload to GitHub
git pull download from GitHub

GIT / GITHUB 4
Command Meaning
git clone copy repo
git branch manage versions
git merge join versions

Basic
git init
git status
git add .
git commit -m "message"
git push
git pull
git clone

GIT / GITHUB 5

You might also like