Git Cheat Sheet
🔧 Setup
Set your name and email
Set default branch to main
📁 Create or Clone Repository
Initialize new repository
Clone existing repository
📄 Staging and Committing
Check file status
Stage changes
Commit staged changes
Amend last commit
🔙 Undoing Changes
Undo Last Commit (Not Pushed)
Keep changes staged
Keep changes unstaged
Discard commit and changes
Reset to Specific Commit
Soft reset
Mixed reset (default)
Hard reset
Revert a Commit (Safe for Pushed Commits)
Create a new commit that undoes an old one
🌳 Branching
List branches
Create new branch
Switch to a branch
Create and switch
Delete branch
🔀 Merging & Rebasing
Merge a branch into current
Rebase current branch onto another
Interactive rebase
📤 Pushing & Pulling
Push commits
Push new branch and track it
Pull latest changes
🔍 Viewing History
Full commit log
Condensed view
Inspect specific commit
🧹 Cleaning Up
Delete untracked files/folders
Temporarily save changes
Reapply stashed changes
📦 Tags
Create a new tag
Push tag to remote
🔗 Remote Repositories
View remotes
Add a remote
Remove a remote