Git Cheatsheet
Config
git config --global user.name "name"
git config --global user.email "email"
Branch
git branch -a # List all
git checkout -b <name> # Create + switch
git branch -d <name> # Delete local
git push origin --delete <name> # Delete remote
Commit
git add -p # Stage từng phần
git commit --amend # Sửa commit gần nhất
git reset HEAD~1 # Undo commit (giữ changes)
git reset --hard HEAD~1 # Undo commit (xóa changes)
Stash
git stash # Cất tạm
git stash pop # Lấy lại
git stash list
Merge / Rebase
git merge <branch>
git rebase <branch>
Log
git log --oneline --graph
git log --oneline -5