Apologies, it was easy:

git archive -o changed.zip $COMMIT $(git diff --name-only $COMMIT $COMMIT^ | sed ‘s/.*/"&"/’)

🌐
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 branch. With a git log you can see the id of the commit , something like this:
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
Feature request: `gh pr diff <ref> --name-only`
Describe the feature or problem you’d like to solve It would be great if gh pr diff supported a --files or --name-only flag to simply print the list of files changed in a PR rather than show a comp... More on github.com
🌐 github.com
2
August 11, 2022
Question: diff --name-only command implementation
Hey-hey, I tried to create following git command with go-git: git diff --name-only --diff-filter=AM HEAD~5 HEAD -- . At some point in my code I have a Patch and iterate over stats: patch, _ := last... More on github.com
🌐 github.com
10
November 1, 2018
git - How to list only the names of files that changed between two commits - Stack Overflow
Looks like mostly correct answer! Simple git diff --name-only master..branch doesn't correspond to github PR list. This way more precise. But anyway I have 173 chaned files vs 171 in github PR. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Git
git-scm.com › docs › git-diff
Git - git-diff Documentation
Just like --name-only the file names are often encoded in UTF-8. ... Specify how differences in submodules are shown. When specifying --submodule=short the short format is used. This format just shows the names of the commits at the beginning and end of the range.
🌐
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?

🌐
GitHub
github.com › cli › cli › issues › 6060
Feature request: `gh pr diff <ref> --name-only` · Issue #6060 · cli/cli
August 11, 2022 - Describe the feature or problem you’d like to solve It would be great if gh pr diff supported a --files or --name-only flag to simply print the list of files changed in a PR rather than show a complete diff. Proposed solution This could ...
Author   cli
🌐
GitHub
gist.github.com › digbot › 4d63c1a615be8c7de03acae63a410ea8
Git diff --name-only and copy that list · GitHub
May 27, 2019 - Git diff --name-only and copy that list · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
Bassochette
bassochette.github.io › memo › 2016 › 12 › 21 › git-diff-show-only-file-names
git diff show only file names - coffee and 🚬
Github · Twitter · $ git diff --name-only · Stack overflow · ← Previous Archive Next → · 21 December 2016 · memo · git 5 ·
🌐
GitHub
gist.github.com › 7916308
These two commands creates a tar file of all the changed files and a txt file with a list of the changed files. · GitHub
#you can also do the git diff commands with the commit hash git diff --name-only 567a29a 23caaf595 | xargs tar -czf files.tar.gz
Find elsewhere
🌐
GitHub
github.com › src-d › go-git › issues › 1014
Question: diff --name-only command implementation · Issue #1014 · src-d/go-git
November 1, 2018 - Hey-hey, I tried to create following git command with go-git: git diff --name-only --diff-filter=AM HEAD~5 HEAD -- . At some point in my code I have a Patch and iterate over stats: patch, _ := lastCommit.Patch(&firstCommit) for i := 0; i...
Author   src-d
🌐
Stack Overflow
stackoverflow.com › questions › 41496003 › use-name-only-option-with-github-api-diff-media-format
Use --name-only option with GitHub API diff media format - Stack Overflow
Is there a way to retrieve only filenames? The documentation I have consulted is https://developer.github.com/v3/media/#commits-commit-comparison-and-pull-requests ... I just found documentation on the 'compare' resource at the following link: https://developer.github.com/v3/repos/commits/#compare-two-commits · It seems that instead of using the diff media type I can simply request from the following URL:
🌐
Dustin John Pfister
dustinpfister.github.io › 2020 › 07 › 07 › git-diff
Git diff examples | Dustin John Pfister at github pages
November 1, 2021 - The git diff command is useful for finding changes between two commits when using git for source control. there are many options for formatting the output also, so for one example say I am just interesting in getting a list of files that have changed from a given starting and ending commit it, such a task can be completed by using the git diff command with the name only option.
🌐
Explain Shell
explainshell.com › explain
explainshell.com - git diff --cached --name-only; git diff --name-only
git diff(1) distro · arch latest · ubuntu 26.04 --cached --name-only; git diff(1) distro · arch latest · ubuntu 26.04 --name-only ·
🌐
Reddit
reddit.com › r/git › git-diff --name-only was too difficult to understand, so i created tiri
r/git on Reddit: git-diff --name-only was too difficult to understand, so I created tiri
October 30, 2019 - Online • · oguzbilgic · ADMIN ... tree (available as package on most Linux distros) can be used for that: git diff --name-only HEAD~ | tree --fromfile ....
🌐
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 ...
🌐
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 ...