You can use this command to see the changed file names, but not with line numbers:

git diff --name-only

Go forth and diff!

Answer from phreakhead on Stack Overflow
🌐
Git
git-scm.com › docs › git-diff
Git - git-diff Documentation
Instead of comparing with the tip of "test" branch, compare with the tip of the current branch, but limit the comparison to the file "test". Compare the version before the last commit and the last commit. ... Changes between the tips of the topic and the master branches. Same as above. Changes that occurred on the master branch since when the topic branch was started off it. ... $ git diff --diff-filter=MRC (1) $ git diff --name-status (2) $ git diff arch/i386 include/asm-i386 (3) Show only modification, rename, and copy, but not addition or deletion.
Discussions

name-only diff between branches shows changes, but regular diff for any specific file is empty
Do git diff --raw Does it show different hash or mode? More on reddit.com
🌐 r/git
4
1
August 9, 2024
git diff --name-only and spaces
As for the rest of the file commited - it will use the diff as it is ... Beta Was this translation helpful? Give feedback. ... Welcome to the Github Community Forum! This is a little triky, but i think we can get on it… · From now on i will call B the commit that you have create last and A the previous commit, and also consider to start from the master ... More on github.com
🌐 github.com
1
1
git - Showing which files have changed between two revisions - Stack Overflow
Was wondering if there's something like "git status master..branch" to only see those files that are different between the two branches. More on stackoverflow.com
🌐 stackoverflow.com
git diff - How to show only filenames with "git status"? - Stack Overflow
$ git status On branch master Your ... 'origin/master'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) (commit or discard the untracked or modified content in submodules) modified: my-file (modified content) ... There isn't one. But git status is just one of many Git tools. If you want different results, use different tools, such as git diff --name-only... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Explain Shell
explainshell.com › explain
explainshell.com - git diff master...my-branch --name-only -- "*.ts" "*.tsx" "*.js" "*.jsx"
git diff(1) master...my-branch --name-only -- "*.ts" "*.tsx" "*.js" "*.jsx" source manpages: git-diff
🌐
Moakh
moakh.com › blog › git diff: only show filenames
Git Diff: Only Show Filenames | moakh
April 9, 2023 - Sometimes it’s useful to be able to list only the filenames of changed files when using the git diff command. The way to view just the filenames when using git diff is to add a --name-only flag like this:
🌐
Reddit
reddit.com › r/git › name-only diff between branches shows changes, but regular diff for any specific file is empty
r/git on Reddit: name-only diff between branches shows changes, but regular diff for any specific file is empty
August 9, 2024 -

Edit [Solved]: As per u/ppww's comment, I wasn't in the root directory of the repo, so my paths were invalid.

If I do the following command, I get a really long list of changed files. Most of which I expect, but some shouldn't have changed:

git diff --name-only myBranch1 myBranch2

For example, one of the files mentioned in the diff is src/general/Log.php

But if I use the following command to check the difference in that particular file, it just prints an empty line and exits the diff:

git diff myBranch1 myBranch2 -- src/general/Log.php

Trying to diff a directory instead of a file does the same thing.

I did however confirm that if I do a full diff across the two branches (not name-only) it does actually show the differences, but as there is a lot in there, most of which isn't what I'm looking for, it would be really tedious to view the whole diff.

What am I doing wrong?

🌐
Sushihangover
sushihangover.github.io › git-getting-a-list-of-files-changed-between-branches
Git - Getting a list of files changed between branches - SushiHangover
June 4, 2015 - Getting a list of changed files between to different branches or tags could not be any easier when using the ‘–name-only’ diff option: git diff --name-only mono-3.2.5 mono-3.2.6 configure.in mcs/class/Facades/Makefile mcs/class/Facades/System.Dynamic.Runtime/TypeForwarders.cs mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/AssemblyInfo.cs mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/Makefile ...
Find elsewhere
🌐
GitHub
github.com › orgs › community › discussions › 21723
git diff --name-only and spaces · community · Discussion #21723
As for the rest of the file commited - it will use the diff as it is ... Beta Was this translation helpful? Give feedback. ... Welcome to the Github Community Forum! This is a little triky, but i think we can get on it… · From now on i will call B the commit that you have create last and A the previous commit, and also consider to start from the master ...
🌐
Better Stack
betterstack.com › community › questions › list-names-of-changed-files-between-commits
How to List Only the Names of Files That Changed between Two Commits | Better Stack Community
June 24, 2024 - If you want to see the names of files that were modified, but not the exact changes made to them, -name-only is the appropriate option to use. You can also use other options with git diff to customize the output, such as -name-status to include ...
🌐
Tsuji
tsuji.tech › home › posts › git
Git Diff with Only File Names | tsuji.tech
November 11, 2024 - Print git diff with only file names. git diff --name-only
🌐
Makandra
makandracards.com › makandra › 15763-git-show-filenames-diff
Git: How to show only filenames for a diff - makandra dev
April 24, 2013 - Need a quick view of changed files without the full patch; `git diff --name-only` lists filenames, while `--stat` and `--numstat` add compact change counts.
🌐
Bassochette
bassochette.github.io › memo › 2016 › 12 › 21 › git-diff-show-only-file-names
git diff show only file names - coffee and 🚬
$ git diff --name-only · Stack overflow · ← Previous Archive Next → · 21 December 2016 · memo · git 5 ·
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › how to compare two git branches
How to Compare Two Git Branches | phoenixNAP KB
July 3, 2025 - Displaying changes for every line can clutter the output and make it difficult to see general changes. If you want only to see where the changes occurred, use the --name-only option with the git diff command.
🌐
LichtenBytes
mlichtenberg.wordpress.com › 2021 › 12 › 21 › finding-everything-that-has-changed-in-a-git-branch
Finding Everything That Has Changed in a Git Branch | LichtenBytes
December 21, 2021 - Go there for more information, as well as some alternatives. To get the list of files modified (and committed!) in the current branch you can use the shortest console command using standard git: git diff --name-only master...
🌐
Linux find Examples
queirozf.com › entries › git-diff-reference-and-examples
Git Diff: Reference and Examples
April 28, 2025 - $ git diff origin/master diff --git a/file3.txt b/file3.txt new file mode 100644 index 0000000..a309e46 --- /dev/null +++ b/file3.txt @@ -0,0 +1 @@ +this is file3 · Only files that have been staged (git added) will show up. Use git diff <remote_name>/<branch_name> -- .
🌐
Quora
quora.com › How-do-you-list-only-the-file-name-changes-between-two-commits-in-git
How to list only the file name changes between two commits in git - Quora
Answer (1 of 8): > How do you list only the file name changes between two commits in git? With git diff, the solution is straightforward: [code]git diff --name-only commitA commitB [/code]If I may read between the lines and guess that you actually want the commit identifiers listed, along with ...