Git Cheatsheet

Git command reference and cheatsheet.

🚀 Basic Commands

git init
Initialize a new Git repository
git clone <url>
Clone a repository from a URL
git status
Show the working tree status

🌿 Branch Commands

git branch
List, create, or delete branches
git checkout <branch>
Switch to a branch
git merge <branch>
Merge a branch into the current branch

💾 Commit Commands

git add <file>
Add files to the staging area
git commit -m "message"
Commit changes with a message
git reset <file>
Remove files from the staging area

☁️ Remote Commands

git remote add <name> <url>
Add a remote repository
git push <remote> <branch>
Push commits to a remote repository
git pull <remote> <branch>
Pull changes from a remote repository

📜 History Commands

git log
Show commit history
git diff
Show changes between commits
git show <commit>
Show commit details

Advanced Commands

git stash
Stash changes temporarily
git rebase <branch>
Reapply commits on top of another branch
git cherry-pick <commit>
Apply a commit to the current branch