[Practical Git] Filter commit history with git log arguments
In the last lesson, we learned how to format the git log output; in this lesson we will learn how to filter down to a specific set of commits. By default, git log shows every commit in a repo. We will walk through using a bunch of options to filter our git log commits to a more meaningful set (-n, --after, --before, --author, --grep, -S, -G, --no-merges, {ref}..{ref}, {files}). We will also show how all of the formatting and filtering options can be composed together to query exactly what you are looking for in your commit history.
Show lasat N commit:
git log - // show last three commit
Show commits from a center time:
git log --after="yesterday" // Show the commit between yesterday and today
git log --after="10 minutes ago"
git log --after="2 weeks ago"
git log --after="3/15/16" // Match 15, 2016
Combine with --before:
git log --after="3/15/16" --before="yesterday"
The same as:
git log --since="3/15/16" --until="yesterday"
Filter by author:
git log --author="Tavor"
Filter by the commit message:
git log --grep="copyright"
Filter by the code using string:
git log -S"Math.random" -p // get all the commit which has Math.random changes in the code, and use -p option to see the code
Filter by the code using Regex:
git log -p -GMath\|random // Using 'G' without quotes and follow with regex math or random
Ingore the case:
git log -i --author="Jane" // search both for "Jane" and "jane" git log --author="Jane" // search only for "Jane"
Filter out merges commit:
git log --no-merges
See the commits between two branch:
git log master..cool-feature
Search by files:
git log LIENCE.md README.md // search for lience and readme files
Example:
git log - README.md -p -i --author="Tavor" // Want to see last 3 change on README.md file by author Tavor, ignor the case, and show the code
git log -S"Math" --after="2 months ago" --oneline --stat
[Practical Git] Filter commit history with git log arguments的更多相关文章
- [Practical Git] Format commit history with git log arguments
When running the git log command, we can pass in options as arguments toformat the data shown for ea ...
- git 版本(commit) 回退 -- 使用git reset 指令
刚刚提交了三个commit, git reflog显示如下: 最后一个commit在文件末尾加了一行:v3,以此类推: 下面,使用git reset --hard commitID来进行commit回 ...
- Git 学习(三)本地仓库操作——git add & commit
Git 学习(三)本地仓库操作——git add & commit Git 和其他版本控制系统如SVN的一个不同之处就是有暂存区的概念.这在上文已有提及,本文具体说明什么是工作区及暂存区,以及 ...
- git常用命令,学git代码管理
下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一. ...
- Git详解之十 Git常用命令
下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一. ...
- 10年阿里自动化测试架构师帮您收集的:git常用命令大全以及git原理图【泣血推荐,建议收藏】
一.Git分布式版本控制简介 Git 是一个很强大的分布式版本控制系统.它不但适用于管理大型开源软件的源代码,管理私人的文档和源代码也有很多优势.本来想着只把最有用.最常用的 Git 命令记下来, ...
- Git学习01 --git add, git commit , git log ,git status, git reset --hard, head
Git官方提供的快速入门教程:https://try.github.io/levels/1/challenges/1 特点:Git极其强大的分支管理:分布式版本 集中式版本控制系统,版本库是集中存放在 ...
- Git删除commit提交的log记录
基于 GitFlow 工作流,可能某个提交(commit)导致了 bug,或者有多个提交需要返工,此时你就会用到删除提交. 接下来的内容都基于下面这张 git log 提交记录图来写. git l ...
- [Git] Use git add --patch for better commit history and mitigating bugs
Let's split our changes into separate commits. We'll be able to check over our changes before stagin ...
随机推荐
- SCADA软件整体架构
SCADA软件整体框架如下所示: 1.免费版本可以支持的IO容量为2048点,无运行时间限制. 2.免费版本仅支持本地Runtime运行,CLServer服务器只能运行24小时. 3.免费版本支持的驱 ...
- EasyUI 添加tab页(iframe方式)
function addTab(title, href,icon){ var tt = $('#tabs'); if (tt.tabs('exists', title)){//如果tab已经存在,则选 ...
- 利用IE/FF的不同识别CSS来使用浏览器兼容问题
区别IE6与FF: background:orange;*background:blue; 区别IE6与IE7: background:green !important;background:blue ...
- 转换Json格式帮助类
using System; using System.Collections.Generic; using System.Text; using System.Reflection; using Sy ...
- 为枚举类型添加说明 zt
enum Orientation { [DescriptionAttribute("东")] East, [DescriptionAttribute("南")] ...
- java快速获取大图片的分辨率(大图片格式JPG,tiff ,eg)
问题描述:怎样快速获取一个20MB图片的分辨率? 程序代码: package test; import java.awt.Dimension; import java.awt.image.Buffer ...
- asp.net文本编辑器(FCKeditor)
FCKeditor介绍 FCKeditor是一个功能强大支持所见即所得功能的文本编辑器,可以为用户提供微软office软件一样的在线文档编辑服务.它不需要安装任何形式的客户端,兼容绝大多数主流浏览器, ...
- Selenium webdriver 之select 控件封装,解决onchange问题
使用webdriver的时候,select 控件经常会绑定onchange 事件,在selenium2.09 之前click 方法对onchange 事件有bug,2.09 以后修复了,但是根据经验也 ...
- C#发送简单的HTTP POST请求给传统的ASP网页。
设计思路 创建HTTPWebRequest类的一个实例,设置这个对象的Method属性为"POST",ContentType属性为"application/x-/www- ...
- 面向对象基础(class0425)字符串与集合
常用类库 学习.net就是学习它的无数个类库怎么用,先看两个简单的 String 字符串,不可变特性.字符串可以看成字符数组 属性 Length 方法 IsNullOrEmpty() 静态方法 ToC ...