git config --global user.name "Ten" All topics
Git
Các lệnh Git thường dùng, từ cơ bản đến nâng caoEveryday Git commands, from the basics to the advanced
git config --global user.email "email@example.com"git config --listgit initgit init -b maingit clone <repo-url>git clone --depth 1 <repo-url>git clone -b <branch> <repo-url>git clone --recurse-submodules <repo-url>git statusgit status -sbgit add <file>git add .git add -pgit commit -m "message"git commit -am "message"git commit --amendgit commit --amend --no-editgit diffgit diff --stagedgit diff --statgit diff <a>..<b>git loggit log --oneline --graph --allgit log --author="Ten"git log -- <file>git show <commit>git show <commit>:<file>git branch -agit branch <ten-nhanh>git branch -d <ten-nhanh>git branch -D <ten-nhanh>git branch -m <ten-cu> <ten-moi>git checkout <branch>git checkout -b <ten-nhanh>git checkout -- <file>git switch <branch>git switch -c <ten-nhanh>git switch -git merge <branch>git merge --no-ff <branch>git merge --squash <branch>git merge --abortgit remote -vgit remote add origin <repo-url>git remote set-url origin <repo-url>git remote remove <ten>git fetch origingit fetch -pgit fetch --allgit pullgit pull --rebasegit pull --ff-onlygit pushgit push -u origin <branch>git push --force-with-leasegit push --tagsgit push origin --delete <branch>git restore <file>git restore --staged <file>git restore --source <commit> <file>git reset --soft HEAD~1git reset HEAD~1git reset --hard <commit>git reset <file>git rm <file>git rm --cached <file>git mv <cu> <moi>git tag -lgit tag -a v1.0.0 -m "Release 1.0.0"git tag -d <ten-tag>git stash pushgit stash push -u -m "wip: mo ta"git stash listgit stash popgit stash applygit stash dropgit rebase <branch>git rebase --onto <newbase> <upstream> <branch>git rebase -i HEAD~3git rebase --continuegit rebase --abortgit cherry-pick <commit>git cherry-pick -n <commit>git cherry-pick --continuegit cherry-pick --abortgit revert <commit>git revert -n <commit>git refloggit reset --hard HEAD@{2}git worktree add <duong-dan> <branch>git worktree add <duong-dan> -b <ten-nhanh>git worktree listgit worktree remove <duong-dan>git worktree prunegit bisect startgit bisect badgit bisect good <commit>git bisect resetgit submodule add <url> <duong-dan>git submodule update --init --recursivegit submodule statusgit blame <file>git blame -L 10,20 <file>git clean -ndgit clean -fdgit describe --tags --always --dirtygit sparse-checkout init --conegit sparse-checkout set <duong-dan>git sparse-checkout disablegit archive --format=tar.gz -o release.tar.gz HEADgit shortlog -snegit am -3 <file.patch>git am --abortgit gcgit gc --aggressive --prune=now