当前位置: 首页 > 工具软件 > DevOps-Guide > 使用案例 >

DevOps - Git - 信息查看

段恩
2023-12-01

git help

git version  # Display the version of git.

git help  # Prints the synopsis and a list of the most commonly used commands.
git help git  # Display the git man page.

git <COMMAND> -h  # Display the brief help.
git help <COMMAND/CONCEPT>  # Display help for specific subcommand or concept. "git  <COMMAND/CONCEPT> --help"

git help --help  # Display the help of 'git help'.
git help --all  # Print all available commands on the standard output.
git help --guide  # Print a list of the useful Git guides on the standard output.

git config

git config --list  # 显示所有配置信息
git config --global --list  # 显示全局配置信息
git config --local --list  # 显示local repository配置信息(在local repository目录下执行)

git remote

git remote  # 查看remote repository信息
git remote -v  # 查看remote repository详细信息。如果没有推送权限,就看不到remote repository的地址

git status

git status  # Show the working tree status. 
git status --short  # Give the output in the short-format.

git log

git log  # 查看commit日志
git log <file>  # 查看某个文件的commit日志
git log -3  # 查看最近3次的commit日志


git log -p  # 补丁格式显示每个提交之间的具体差异
git log --stat  # 显示每个提交的文件修改统计信息

git log --oneline  # 逐条简洁显示commit日志
git log --oneline --graph  # 图形化显示分支合并历史
git log --oneline --graph --decorate  # 图形化显示分支合并历史,包含commit的引用信息

git log --merges  # 只显示merge commit日志
git log --no-merges  # 显示过滤merge commit之后的git log

git log --author=<author name>  # 搜索指定作者的提交历史
git log --grep=<pattern>  # 搜索commit描述匹配<pattern>的commit.
git log --after="2016-12-1" --before="2017-1-1"  # 显示某个时间段的commit日志

git shortlog

git shortlog  # Summarize 'git log' output order by the author
git shortlog --summary  # Suppress commit description and provide a commit count summary only.
git shortlog --numbered  # Sort output according to the number of commits per author instead of author alphabetic order.
git shortlog --email  # Show the email address of each author.

git reflog

git reflog  # 显示命令日志

git show

git show  # 查看上一次commit的内容:
git show <commit id>  # 查看某次commit的内容
git show <commit>:<filename>  # 显示某次提交时,某个文件的内容

git diff

git diff  # 显示暂存区和工作区的差异
git diff HEAD  # 显示工作区与当前分支最新commit之间的差异
git diff <commit-id-1>..<commit-id-2>  # 查看commit之间的对比
git diff <branch-name-1> <branch-name-2>  # 查看branch之间的对比

git blame

git blame <file>  # Show what revision and author last modified each line of a file.

转载于:https://www.cnblogs.com/anliven/p/6354590.html

 类似资料: