Skip to content

chmouel/consult-vc-modified-files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

55 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MELPA

๐Ÿ” consult-vc-modified-files

consult-vc-modified-files provides a easy way to list Git-tracked files that have been modified, newly added, or are part of the HEAD commit in a project.

It integrates with Emacs' built-in vc and diff-mode libraries, as well as the consult package for navigation.

โœจ Features

  • ๐Ÿ“„ View locally modified files in the current Git project
  • ๐Ÿ“ฆ List files from the HEAD commit
  • ๐Ÿ†• List newly added (untracked) files separately
  • ๐Ÿ“‹ Show files staged for commit in the Git staging area
  • ๏ฟฝ๏ธ Select and explore files from any past commit with diff previews
  • ๏ฟฝ๐Ÿ› ๏ธ Customize sources for specific use cases
  • ๐Ÿงญ Navigate the open files with consult
  • ๐Ÿ‘๏ธ Preview the diff or the commit for the current selection
  • ๐Ÿ”„ Smart preview window management (no more duplicate preview windows!)
  • ๐Ÿ” Show the commit message of the modified files in HEAD
  • ๐Ÿงต Narrow to the right type of files with the consult-narrow-key (> by default):
    • h for modified in HEAD
    • a added (untracked) files
    • l modified locally
    • c staged for commit.

Caution

This only works with Git repositories and no other version control systems.

๐Ÿ“ธ Screenshot

screenshot-consult-vc-modified-files

Preview with git show the HEAD files and git diff the modified files

recording-20250225-12h54.mp4

Browse modified files of a commit with consult-vc-log-select-files

Screen.Recording.2025-07-25.at.00.15.34.mov

๐Ÿ“ฅ Installation

Using use-package and MELPA

(use-package consult-vc-modified-files
  :bind
  ;; choose any other key bindings you prefer
  (("C-x v /" . consult-vc-modified-files)
   ("C-x v ." . consult-vc-log-select-files)))

๐Ÿš€ Usage

Browsing Modified Files

Call the interactive function consult-vc-modified-files, or use a key binding like C-x v / (if configured with the configuration above).

When invoked, the command show a prompt for selecting files based on customizable sources:

  • ๐Ÿ”„ Modified locally: Lists locally modified or untracked files
  • ๐Ÿ†• Added files: Lists new untracked files
  • ๐Ÿ“‹ Staged for commit: Lists files added to the Git staging area
  • ๐Ÿ“ฆ Modified in HEAD: Lists files modified in the HEAD commit

Browsing Files from a Specific Commit

Call the interactive function consult-vc-log-select-files to:

  1. Select a commit from the repository history
  2. Choose a file that was modified in that commit
  3. See a live diff preview of the changes made to that file in the commit

This is useful for reviewing changes from past commits without having to use a separate git tool.

You can customize the available sources using the consult-vc-modified-files-sources variable.

๐Ÿ”ฎ Preview Features

  • ๐Ÿ“Š Live diff preview: See the changes in each file as you navigate through options
  • ๐Ÿง  Commit diff preview: View exact changes made to files in any historical commit
  • ๐ŸŒˆ Syntax highlighting: Previews use diff-mode

โš™๏ธ Customization

Configure Sources

You can customize which file categories appear in the selection when using consult-vc-modified-files by setting the consult-vc-modified-files-sources variable. This allows you to control exactly which types of files are presented in the interface.

For example, if you want to show all modified files except those modified in branch heads:

(setq consult-vc-modified-files-sources
      '(consult-vc-modified-files-source-modified-files
        consult-vc-modified-files-source-added-files
        consult-vc-modified-files-source-staged-files))

This configuration includes:

  • Modified files (tracked files with changes)
  • Added files (new untracked files)
  • Staged files (changes ready for commit)

But it excludes files modified in branch heads.

Display Git Commit Messages when showing the HEAD files

You can control whether to show commit message descriptions for files modified in HEAD with the consult-vc-modified-files-show-description customization option:

(setq consult-vc-modified-files-show-description t)  ;; Show descriptions (default is nil)

When enabled, this option displays the commit message next to each file modified in the HEAD commit, providing more context about the changes.

  • When t: Shows commit message descriptions for HEAD files
  • When nil: Shows only the filenames without descriptions

Customize Faces

Adjust the appearance of listed files by customizing:

  • ๐ŸŽจ consult-vc-modified-files-face: For locally modified files
  • ๐ŸŽญ consult-vc-modified-head-files-face: For files modified in HEAD
  • ๐Ÿšฉ consult-vc-modified-files-added-face: For new (untracked) files
  • ๐Ÿ“‹ consult-vc-modified-files-staged-face: For files staged for commit

๐Ÿ‘ฅ Authors

Chmouel Boudjnah

๐Ÿ“ƒ License

This project is licensed under the GPL-3.0.

About

List git modified files in a project with vc

Topics

Resources

License

Stars

23 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors