noknow.dev
Sign inSign up
Course overview
Git — Complete Course
0 / 24 lessons0%

Git Basics

  • git init — Starting a Repository
  • git add + git commit — Your First Commit
  • git status + git log — Reading the State
  • git diff — Seeing What Changed
  • .gitignore — Ignoring Files

Branching

  • git branch + git switch — Working with Branches
  • git merge — Combining Branches
  • Resolving Merge Conflicts
  • Cleaning Up Branches

Remote Repositories

  • git remote — Connecting to a Remote
  • git push — Uploading Your Commits
  • git fetch + git pull — Getting Remote Changes
  • git clone — Copying a Repository

Undoing Changes

  • git restore — Discarding Uncommitted Changes
  • git reset — Moving HEAD Back
  • git revert — Safely Undoing a Commit
  • git stash — Temporarily Saving Work

Rewriting History

  • git commit --amend — Fixing the Last Commit
  • git rebase — Cleaner History
  • git cherry-pick — Applying Specific Commits

Advanced Tools and Workflows

  • git tag — Marking Releases
  • Mastering git log
  • git bisect — Finding Bugs with Binary Search
  • Professional Git Workflows

Mastering git log

0m 00s

Querying Your Repository's History

git log is extremely powerful once you know its options:

git log --oneline                  # compact view
git log --oneline --graph --all    # visual branch graph
git log --stat                     # show changed files + line counts
git log -p                         # show full diffs

# Filter by time
git log --since="2 weeks ago"
git log --after="2024-01-01" --before="2024-06-01"

# Filter by author
git log --author="Alice"

# Filter by content (search commit messages)
git log --grep="fix"
git log --grep="bug" -i             # case-insensitive

# Filter by what changed in files (pickaxe)
git log -S "functionName"          # commits that added/removed that string
git log -G "regex"                 # commits where diff matches regex

# Range: commits in feature not in main
git log main..feature --oneline

# Formatting
git log --format="%h %an %s"       # hash, author name, subject

Your Task

The repo has several commits. Write a command that prints only commits whose message contains the word "feature" (case-insensitive). Store the count of such commits in a variable and print it.

Back
bashCtrl+Enter to run
Output

Click "Run" to execute your code.