1.查询git所有支持的子命令列表
git help --all
2.git 子命令查询帮助方法
git help subcommand
git --help subcommand
git subcommand --help
3.git 配置
git config --global user.name "Hunter"
git config --global user.email "hunter@gmail.com"
git config --global colore.diff auto
git config --global colore.branch auto
4.查询当前git配置信息
git config --list或者git config -l
5.git移除配置选项 --unset
git config --unset --global user.email
6.配置git默认的编辑器
export GIT_EDITOR=vim
修改文件:~/.bashrc
7.git commit file.html
此时会使用vim打开一个文档,添加内容Convert to HTML,关闭后会自动添加一条修改记录,类似于git commit -m "xxxx"
说明:只有文件file.html发生变化时,git commit file.html才会打开编辑器,否则不会。
8.git log查看修改记录以及commit描述信息,
git log
如果想查询更加详细的信息,则使用git show commitID,不带参数commitID,默认则只显示最后一次的修改内容。
9.查看包含分支简介的单行摘要
git show-branch --more=10
参数10表示显示额外提交的20个版本修改记录。
10.查看两个commitID之间的差异
git diff commit_ID1 commit_ID2
11.删除仓库中的文件
git rm file
说明:
git rm删除文件后,记得操作git commit添加一条commit 记录
12.利用git rm和git add实现对文件的重命名操作
$ mv fool.html bar.html
$ git rm fool.html
$ git add bar.html
$ git commit -m "xxxxx"
13.git给指定命令操作配置别名
git config --global alias.show-graph "log --graph --abbrev-commit --pretty=oneline"
这样使用git show-graph命令时,就如同已经输入了带所有选项的常常的git log命令一样
14.git log --pretty=oneline
查询commitID和commit描述信息