Git Cheatsheet
Essential Git commands and workflow patterns for version control. Copy commands with a click and keep your development workflow smooth.
Basic Commands
git initInitialize a new Git repository
git clone <url>Clone a repository
git statusCheck status of working directory
git add <file>Stage changes for commit
git commit -m "message"Commit staged changes
git pushPush commits to remote
git pullPull changes from remote
Branching & Merging
git branchList all local branches
git branch <name>Create a new branch
git checkout <branch>Switch to a branch
git checkout -b <name>Create and switch to new branch
git merge <branch>Merge branch into current branch
git branch -d <branch>Delete a branch
Advanced Operations
git stashTemporarily store changes
git stash popApply and remove stashed changes
git reset <file>Unstage changes
git reset --hard HEADDiscard all local changes
git logView commit history
git rebase <branch>Reapply commits on top of another branch
Remote Operations
git remote -vList remote repositories
git remote add origin <url>Add a remote repository
git fetchDownload objects and refs from remote
git pull --rebasePull with rebase instead of merge
git push -u origin <branch>Push and set upstream branch