git init – create new repository
git config –global user.name – set username
git config –global user.email – set email
git config –list – view configuration
git status – check file changes
git add file.txt – stage one file
git add. – stage all files
git commit -m “msg” – save changes
git log – full commit history
git log –oneline – short history
git branch – list branches
git branch new – create branch
git checkout new – switch branch
git checkout -b new – create + switch
git switch new – switch branch (modern)
git merge branch – combine branches
git rebase branch – reapply commits
git pull origin main – fetch + merge
git push origin main – upload changes
git remote add origin URL – connect remote
git remote -v – show remotes
git clone URL – copy repository
git restore file – discard changes
git restore –staged file – unstage file
git reset HEAD file – unstage (alternative)
git reset –hard HEAD – delete all changes
git revert commit_id – undo commit safely
git stash – save temporary work
git stash pop – restore stashed work
git stash list – list saved stashes
git diff – show code changes
git show commit_id – view commit details
git blame file – show author per line
git cherry-pick commit_id – copy commit
git tag v1.0 – create version tag
git fetch – download updates only
git clean -f – remove untracked files
git rm file – delete tracked file
-git mv old new rename file
git reflog – show all history actions
40 GIT Commands
calendar_today
Đăng ngày: 27/04/2026