đ Git Commands Cheat Sheet
Quick reference guide for commonly used Git commands. Perfect for developers!
âī¸ Setup & Config
git config --global user.name "[name]"
Set your username
git config --global user.email "[email]"
Set your email
git init
Initialize a new repository
git clone [url]
Clone a repository
đ Basic Commands
git status
Check status of files
git add [file]
Add file to staging
git add .
Add all files to staging
git commit -m "[message]"
Commit with message
đŋ Branching
git branch
List all branches
git branch [name]
Create new branch
git checkout [branch]
Switch to branch
git merge [branch]
Merge branch
git branch -d [branch]
Delete branch
đ Remote Repository
git remote add origin [url]
Add remote repository
git push origin [branch]
Push to remote
git pull
Pull from remote
git fetch
Fetch from remote
âŠī¸ Undoing Changes
git reset [file]
Unstage file
git checkout -- [file]
Discard changes
git reset --hard
Reset to last commit
git revert [commit]
Revert commit
đ Inspection & Comparison
git log
View commit history
git log --oneline
Compact commit history
git diff
Show file differences
git show [commit]
Show commit details
đž Stashing
git stash
Stash changes
git stash list
List stashes
git stash pop
Apply & remove stash
git stash drop
Delete stash
đˇī¸ Tags
git tag
List all tags
git tag [name]
Create tag
git push origin [tag]
Push tag to remote
git tag -d [tag]
Delete tag