gitlab-org--gitlab-foss/doc/university/training/topics/git_log.md

67 lines
960 B
Markdown
Raw Normal View History

2017-11-01 11:56:40 -04:00
---
comments: false
---
2016-10-20 06:38:32 -04:00
# Git Log
----------
Git log lists commit history. It allows searching and filtering.
* Initiate log
```
git log
```
2016-10-20 06:38:32 -04:00
* Retrieve set number of records:
```
git log -n 2
```
2016-10-20 06:38:32 -04:00
* Search commits by author. Allows user name or a regular expression.
```
git log --author="user_name"
```
2016-10-20 06:38:32 -04:00
----------
* Search by comment message.
```
git log --grep="<pattern>"
```
2016-10-20 06:38:32 -04:00
* Search by date
```
git log --since=1.month.ago --until=3.weeks.ago
```
2016-10-20 06:38:32 -04:00
----------
## Git Log Workflow
1. Change to workspace directory
1. Clone the multi runner projects
1. Change to project dir
1. Search by author
1. Search by date
1. Combine
2016-10-20 06:38:32 -04:00
----------
## Commands
```
cd ~/workspace
2017-10-31 05:20:40 -04:00
git clone git@gitlab.com:gitlab-org/gitlab-runner.git
cd gitlab-runner
2016-10-20 06:38:32 -04:00
git log --author="Travis"
git log --since=1.month.ago --until=3.weeks.ago
git log --since=1.month.ago --until=1.day.ago --author="Travis"
```