git config --global user.name "Your Name"
git config --global user.email "email@example.com"
git init
git clone <url>
git config --list
git config user.name
git status
git log --oneline
git log --graph --all
git add .
git add <file>
git commit -m "message"
git commit -am "message"
git commit --amend
git branch
git branch <name>
git checkout <branch>
git checkout -b <new-branch>
git merge <branch>
git merge --no-ff <branch>
git merge --abort
git branch -d <branch>
git branch -D <branch>
git push origin --delete <branch>
git diff
git diff --staged
git diff HEAD~2
git show <commit>
git blame <file>
git log -p <file>
git log --grep="pattern"
git log -S "code"
git log --author="name"
git remote -v
git remote add origin <url>
git remote set-url origin <url>
git push origin main
git push -u origin <branch>
git pull origin main
git pull --rebase
git fetch origin
git fetch --all
git branch -r
git checkout --track origin/<branch>
git reset HEAD <file>
git checkout -- <file>
git clean -fd
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
git revert <commit>
git restore <file>
git restore --staged <file>
git stash
git stash pop
git stash list
git stash apply stash@{2}
git rebase main
git rebase -i HEAD~3
git rebase --continue
git rebase --abort
git cherry-pick <commit>
git tag v1.0.0
git push --tags
git reflog
git fsck --lost-found
git branch recover <commit>
git reset --hard origin/main
git push --force-with-lease
git bisect start
git checkout --ours <file>
git checkout --theirs <file>
git merge --abort
git log --oneline --graph --all --decorate
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
git diff-tree --no-commit-id --name-only -r <commit>
alias gs='git status'
alias gco='git checkout'
alias gcm='git commit -m'
alias gp='git push'
git add -p # Interactive staging
git commit --fixup <commit>
git stash push -m "WIP: feature"
git checkout main git pull origin main git checkout -b feature/new-feature # Make changes git add . git commit -m "Add new feature" git push -u origin feature/new-feature # Create PR on GitHub
git stash # Save current work git checkout main git pull origin main git checkout -b hotfix/critical-bug # Fix bug git add . git commit -m "Fix: critical bug" git push origin hotfix/critical-bug git checkout main git merge hotfix/critical-bug git push origin main