简单Git命令
- git init : 初始化一个git仓库
- git add <file name>: 把文件加入到缓冲区
- git commit -m<message> : 将文件提交给所在分支
- git status : 查看仓库当前状态(工作区)
- git diff : 查看不同(修改的内容)
- git log : 查看提交日志
- git reset – hard HEAD^ : 回退到上一个版本
- git reset --hard commit_id :回退到<commit_id>的版本
- git reflog : 展示每一次历史命令
- git checkout : 用版本库里的版本替换工作区的版本
- git reset HEAD <file> : 丢弃暂存区修改
- git rm <file> : 在版本库中删除文件
- git branch : 查看分支(当前所处分支前有*)
- git branch <name> : 创建分支
- git checkout <name> : 切换分支
- git checkout -b <name> : 创建+切换分支
- git merge <name> : 合并某分支到当前分支
- git branch -d <name> : 删除分支
- git merge --no-ff -m<message> :
- git stash : 隐藏当前工作现场
- git stash list : 查看被隐藏的工作现场列表
- git stash apply : 恢复工作现场,stash不被删除
- git stash pop : 回复工作现场,stash被删除
- git branch -D <name> : 强行删除尚未被合并的分支