gitlab-org--gitlab-foss/doc/university/training/topics/git_log.md
Marcel Amirault 298252bb6b Fix whitespace in topic, university, workflow docs
Many code blocks are 4spaced, and they render in GitLab
without coloring as a result, even though they are
fenced with a language label. If in a list, other items
will render as being in a code block too, even if not
meant to. This fixes all these issues, and cleans up
minor white space issues in /topic, /university, /update
and /workflow docs.
2019-07-31 10:29:10 +00:00

895 B

comments
false

Git Log

Git log lists commit history. It allows searching and filtering.

  • Initiate log:

    git log
    
  • Retrieve set number of records:

    git log -n 2
    
  • Search commits by author. Allows user name or a regular expression.

    git log --author="user_name"
    
  • Search by comment message:

    git log --grep="<pattern>"
    
  • Search by date:

    git log --since=1.month.ago --until=3.weeks.ago
    

Git Log Workflow

  1. Change to workspace directory
  2. Clone the multi runner projects
  3. Change to project dir
  4. Search by author
  5. Search by date
  6. Combine

Commands

cd ~/workspace
git clone git@gitlab.com:gitlab-org/gitlab-runner.git
cd gitlab-runner
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"