Skip to content

[Feature] Add a follow option to git_log so file history continues past renames #2575

Backlog

Description

@akramcodez

Description

Add a follow option to git_log so the history of a file continues past renames (git log --follow -- <file>).

Use Case

A common agent question is "why does this file look like this, and when did it change?". When the file was moved or renamed at some point, git_log with file stops at the rename commit, so the model sees a short history that starts with "move X to Y" and concludes the file is newer than it is. Today the only way around it is to fall back to execute_bash with git log --follow, which needs approval in normal mode and gives unstructured output.

Proposed Solution

  • New boolean follow parameter on git_log, only meaningful with file.
  • When follow is true and file is set, getCommits adds --follow before the -- separator.
  • When follow is set without file, return a short error rather than silently ignoring it.
  • Optionally default follow to true when file is given, since that is almost always what is wanted; git only supports --follow for a single path, which matches the tool's file argument.

Alternatives Considered

  • Always passing --follow with file and no new parameter. Simpler for the model, but it can be slow on very large histories and changes existing behaviour, so an explicit option (or a default that can be turned off) is safer.
  • Asking the model to use execute_bash. Works, but loses the structured output and read-only approval of git_log.

Additional Context

  • I have searched existing issues to ensure this is not a duplicate
  • This feature aligns with the project's goals (local-first AI assistance)

Implementation Notes (optional)

The change is in getCommits (source/tools/git/utils.ts), the git_log input schema and its formatter, plus a spec that renames a file in a temp repo and checks both commits are listed.

Activity

  1. added
    enhancement
    area:tools
    on Dec 4, 2026
  2. added
    needs-triage
    on Dec 4, 2026
  3. removed
    needs-triage
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolsenhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions