Git 常用命令
查看提交历史
git log
--pretty
git log --pretty=oneline -n
git log --pretty=format:"%h %s" --graph
放弃更改
当文件未被放入暂存区
git checkout -- <filepath> git checkout -- .
文件已经放入暂存区
git reset HEAD <filepath> git reset HEAD .
文件已经提交commit
git reset --hard <commitid> git reset --hard HEAD^
新建分支
git branch <name>
git checkout <name>
# 或者新建并切换:
git checkout -b <name>