Git权威指南 书摘


##
$ git add welcome.txt
warning: LF will be replaced by CRLF in welcome.txt.
The file will have its original line endings in your working directory.

##
git config --system alias.co chectout

#显示版本库.git目录所在的位置
git rev-parse --git-dir

#相对于工作区根木子的相对目录
git rev-parse --show-prefix

#显示回根目录
git rev-parse --show-cdup

#查看配置文件,优先级从高到低
git config -e 版本库级别
git config -e --global 全局
git config -e --system 系统


# allow-empty允许执行空白提交
git commit --allow-empty -m ''

--amend
--reset-author

#精简格式日志
git log --pretty=oneline

#精简格式状态
git status -s
MM welcome.txt
第一个M 暂存区与版本库的比较
第二个M 工作区与暂存区的比较
一样就为空


#撤销暂存区尚未提交的修改
git reset HEAD <file>
#撤销工作区尚未提交的修改
git checkout -- <file>
#撤销 用版本库覆盖暂存区和工作区,
git checkout HEAD <file>

 

git diff 工作区与暂存区比较
git diff HEAD|master 工作区与版本库区比较
git diff --cached [HEAD]|--staged

 

git ls-files 查看暂存区文件

 

posted on 2016-09-23 09:48  珩~  阅读(180)  评论(0编辑  收藏  举报

导航