git branch -vv
git branch -u origin/yourbranch
或者 push 时加上 -u
git push origin/yourbranch -u
git branch -a
git checkout -b <branch-name> orignin/<branch-name>
git branch -d <local-branch-name>
git push origin --delete <remote-branch-name>
git branch -m <new-branch-name>
git tag <version-number>
git push origin --tags
git checkout -b <branch-name> <tag-name>
git checkout <file-name>
git revert <commit-id>
git reset <commit-id>
保留工作区
git reset --hard <commit-id>
不保留工作区和暂存区
git commit --amend
git blame <file-name>
(AS 中右键 Copy Path 可以复制文件路径)
git remote set-url origin <URL>
git checkout <branch-name> && git cherry-pick <commit-id>
git stash list
git stash apply <stash@{n}>
git show <branch-name>:<file-name>
git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/