• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

git diff-files: Compare files using their sha1 hashes and modes

by admin

The “git diff-files” command in Git is used to compare files in your working directory with their corresponding versions in the Git repository. It compares the files based on their SHA-1 hashes and modes (file permissions).

When you run the “git diff-files” command, Git calculates the SHA-1 hash for each file in your working directory and compares it to the corresponding blob object in the Git repository. It also compares the file modes (permissions) between the working directory and the repository.

The command displays the differences between the files in a unified diff format, showing additions, deletions, and modifications. It highlights the specific lines or sections that have changed, providing a clear visual representation of the differences between the working directory and the repository version of the files.

The “git diff-files” command is particularly useful when you want to examine the differences between the files in your working directory and the versions stored in the repository. It helps you identify changes that have been made locally and haven’t been committed yet. This command is different from “git diff”, which compares the changes between different commits or branches.

By using “git diff-files”, you can easily see the modifications made to individual files in your working directory compared to the repository version. This allows you to review and validate your changes before committing them, helping you ensure the accuracy and integrity of your codebase.

git diff-files Command Examples

1. Compare all changed files:

# git diff-files

2. Compare only specified files:

# git diff-files /path/to/file

3. Show only the names of changed files:

# git diff-files --name-only

4. Output a summary of extended header information:

# git diff-files --summary

Filed Under: Linux

Some more articles you might also be interested in …

  1. git init: Initializes a new local Git repository
  2. jello Command Examples
  3. apport-bug Command Examples in Linux
  4. “aws s3 mb” Command Examples
  5. kotlinc Command Examples
  6. laravel Command Examples
  7. cradle sql: Manage Cradle SQL databases
  8. Defining System Jobs Using Cron under Linux
  9. CentOS / RHEL 6 : How to extract initramfs image and edit/view it
  10. runuser: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright