3520

How can I print a plain list of all files that were part of a given commit?

Although the following lists the files, it also includes unwanted diff information for each:

git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
John Smith
  • 7,243
  • 6
  • 49
  • 61
Philip Fourie
  • 111,587
  • 10
  • 63
  • 83
  • 58
    I came here looking for something a bit different. I want to see all files modified for a set of commits and wound up using `git log --until 2013-05-21 --pretty="short" --name-only` with a good effect. – lmat - Reinstate Monica Dec 12 '13 at 17:40
  • 8
    Use this command to get all changes from previous `n` commits till `master`: `git diff-tree --name-status -r @{3} master` – ako Jun 22 '18 at 13:57
  • 5
    `git diff --name-only master` - To list ALL changed files on current branch, comparing to master branch. – Noam Manos Jun 30 '19 at 09:39
  • You can check this answer out: https://stackoverflow.com/questions/17563726/how-can-i-see-the-changes-in-a-git-commit/68474286#68474286 – Pepe Alvarez Mar 09 '22 at 20:36

30 Answers30

4704

Preferred Way (because it's a plumbing command; meant to be programmatic):

$ git diff-tree --no-commit-id --name-only bd61ad98 -r
index.html
javascript/application.js
javascript/ie6.js

Another Way (less preferred for scripts, because it's a porcelain command; meant to be user-facing)

$ git show --pretty="" --name-only bd61ad98    
index.html
javascript/application.js
javascript/ie6.js

  • The --no-commit-id suppresses the commit ID output.
  • The --pretty argument specifies an empty format string to avoid the cruft at the beginning.
  • The --name-only argument shows only the file names that were affected (Thanks Hank). Use --name-status instead, if you want to see what happened to each file (Deleted, Modified, Added)
  • The -r argument is to recurse into sub-trees
Gareth Davidson
  • 4,857
  • 2
  • 26
  • 45
Ryan McGeary
  • 235,892
  • 13
  • 95
  • 104
  • 2
    This shows also all the files which have been untracked with `git rm --cached `. This makes _commit_ only a technical term in this case and showing a bunch of files (as part of the commit) is totally misleading because Git does not show whether a file were added or removed. – karatedog Mar 27 '12 at 14:57
  • 3
    This isn't working for a merge commit. Message: `Merge branch '' of bitbucket.org:xxx/xxx into master` – redolent Mar 04 '13 at 20:20
  • 47
    It should be noted that `diff-tree` won't work when looking at the root commit. – jbranchaud Mar 06 '13 at 05:52
  • 379
    Replacing the `--name-only` option with `--name-status` will give more clear summary. – Kurt Zhong Apr 11 '13 at 03:58
  • 1
    How do you get the same list but with absolute paths? – sliders_alpha Jun 10 '13 at 12:31
  • 37
    If you want it to work on the root commit, use the --root flag. From the man page: "When --root is specified the initial commit will be shown as a big creation event. This is equivalent to a diff against the NULL tree." – Chris Sep 23 '13 at 18:26
  • 31
    `git log --name-only -n 1 ` The last commit would be: `git log --name-only -n 1 HEAD~1..HEAD` – Kurt Nov 11 '13 at 04:20
  • What does the -r stand for ? – Tulains Córdova Nov 21 '14 at 19:50
  • 4
    @user1598390 -r recurses into sub-trees. You can learn about more options with `man git-diff-tree`. – Ryan McGeary Nov 25 '14 at 01:26
  • why not just do a simple `git show --name-only `? – amphibient Feb 04 '15 at 22:27
  • 23
    If anyone is wondering (like I was) why the first way is "preferred," it goes back to @drizzt 's comment; `git show` is "porcelain" (meant to be user facing) and `git diff-tree` is "plumbing" (meant to be used programmatically, e.g. from scripts). The interface for the former may change over time (so the git maintainers could drop `--name-only` although I don't imagine they _would_) for useability reasons, whereas the interface for the latter will be kept as stable as possible for compatibility reasons. – killscreen Jun 29 '15 at 04:42
  • I would prefer to create an alias for the second because using it without a commit hash defaults to the most recent commit. This is particularly useful when rebasing. – Zach Olivare Jul 28 '15 at 19:06
  • `--pretty=""` will also work for most things and is easier to remember, e.g. `vi $(git show --pretty="" --name-only)` – autonymous Jun 03 '16 at 17:25
  • What is `bd61ad98` ? – Eido95 Jul 05 '16 at 19:21
  • @Kurt You don't need to specify `HEAD~1..HEAD` as HEAD is the default. Also you need to use `--pretty=""` to remove all the log cruft. The command should be: `git log --pretty="" --name-only -n 1` – Michaelangel007 Nov 07 '16 at 18:55
  • 2
    @Eido95 It’s (probably) the first eight characters of some commit hash. It can be any reference to a commit, like a tag, branch name, full 40-character hash, or `HEAD`. – Daniel H Apr 27 '17 at 18:08
  • To see all files affected by a list of commit ids you can do this: `git log | grep commit | awk '{print $2}' | xargs -n 1 git diff-tree ... | sort | uniq` – t3o Jun 02 '17 at 06:22
  • 1
    I had some trouble because I was trying to get the files of a merge. Just had to specify the short hash of the parent and then the merge itself, like: `git diff --name-only 8dd6615f24 880ba9a` – Colin Sep 11 '17 at 17:02
  • 2
    @Colin Alternatively, add [the `-m` flag](https://git-scm.com/docs/git-diff-tree#git-diff-tree--m): `git diff-tree --no-commit-id --name-only -m -r bd61ad98`. That may provide non-unique lines - it lists files from each merge head separately from the other merge heads. On UNIX-like platforms, you can tack `|sort|uniq` on the end if that's an issue. – cxw Sep 15 '17 at 13:39
  • 3
    `git show --stat (hash)` as suggested in [this answer](https://stackoverflow.com/a/38406493/3449673) from @VaTo outputs a bit more than you asked for but is easy to remember and perfectly fine in case you are a human and not a machine. Maybe worth mentioning here in the accepted answer to provide an _easy to type_ alternative. – thutt Oct 26 '17 at 08:48
  • I parse porcelain commands in scripts all the time. What's the problem? – Oh Come On Jun 01 '18 at 14:35
  • 2
    @OhComeOn porcelain commands are tweaked to look nice for the user. The Git developers might change the layout (introducing different formatting, like adding separators or using additional words for better description etc.) of the output any time. If you parse that output you may end up having issues in future since you tailored your scripts to that specific layout. "plumbing" commands should however look the same, whatever git version you are using. – tamasgal Nov 14 '18 at 09:36
  • 1
    On my machine there was no difference between including, or not including `--pretty=""`. Why is that? – Caleb Jay Nov 27 '18 at 19:40
  • @RyanMcGeary the above git command is not working for a merge from master to dev branch. Is there any other way available to do it? – Biswajit Maharana Mar 26 '20 at 05:49
  • Using this with `git rev-parse --short HEAD` you will get changed files for your current commit:```git diff-tree --no-commit-id --name-status -r `git rev-parse --short HEAD` ``` – Arsen Khachaturyan Jun 05 '20 at 17:15
  • How to get tree-ish through git command? I'm trying to checkout only files which were modified in last commit. The above commands works well but I'm not able to get tree-ish of last commit through command – Raza Nov 22 '20 at 10:13
  • For a discussion of *porcelain* vs. *plumbing*, see [this answer](https://stackoverflow.com/questions/6976473/what-does-the-term-porcelain-mean-in-git), as well as others in that question thread. – jvriesem Jan 16 '21 at 16:31
  • how do you set this particular command as a .gitconfig alias that takes in a commit hash ? – Ridhwaan Shakeel Jan 18 '21 at 21:13
  • @ArsenKhachaturyan, why couldn't I provide `HEAD` to `git diff-tree` directly? Why `git rev-parse` should be used? – Adam Badura Jul 08 '21 at 04:03
  • *NB* `diff-tree` outputs renames as both the old and new name. `show` only outputs the new name. Use `diff-tree --find-renames` for the similar behavior – CervEd Dec 09 '21 at 10:47
  • Plumbing vs porcelain is a genius nomenclature which I have not encountered before. I will be sure to remember it – FreelanceConsultant Feb 07 '23 at 16:22
  • Well there is a reason why your less preferred way might actually be best for certain scripts, for instance because the hash is the last thing specified, you can then pipe the hash(es) to another command. For instance the following will list every file in every commit: `git log | grep commit | awk '{print $2}' | xargs git show --pretty="" --name-only` – Dexygen Mar 15 '23 at 14:40
347

If you want to get the list of changed files:

git diff-tree --no-commit-id --name-only -r <commit-ish>

If you want to get the list of all files in a commit, you can use

git ls-tree --name-only -r <commit-ish>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jakub Narębski
  • 309,089
  • 65
  • 217
  • 230
  • 1
    The ls-tree with --name-only does not seem to work on 1.6.4.4 or 1.6.3.3. Do you think this is a bug ? – krosenvold Oct 10 '09 at 10:20
  • `git ls-tree --name-only HEAD` (the parameter is **required**; in this example it is HEAD) works for me with git version 1.6.4.3 – Jakub Narębski Oct 10 '09 at 12:20
  • 2
    It turns out the ordering of the parameters is significant here. The one in your post does not work, while the one in your response *does* work - at least until you update your post ;) – krosenvold Oct 10 '09 at 15:17
  • Thanks @krosenvold, I updated my post... Some git commands are not rewritten using parseopt, so ordering of options and non-option agruments might be significant. – Jakub Narębski Oct 10 '09 at 15:57
  • that works better. with git show --pretty="format:" you still have one blank line in beginning, which is not that big problem, but when using it in scripts you have to remove it. So ls-tree works better for me – NickSoft Apr 17 '12 at 11:00
  • 5
    Pass `--no-commit-id` to avoid printing the SHA1, like so: `git diff-tree --no-commit-id --name-only -r ` – John Mellor Aug 15 '12 at 20:00
  • 1
    diff-tree doesn't return anything, possibly because the commit I refer to added files, but not changed any existing. ls-tree gives me a list of all files in the repo, not just the files added/altered in the last commit. I wonder if there's a 3rd command to just list all **new** files (i.e. added in that given commit)? – CodeManX Nov 17 '15 at 23:03
  • 4
    @CoDEmanX : You didn't miss adding `-r` / `-t` option, did you? Because diff-tree handles both modified and added files. If you want to list all new (added) files, use `git diff-tree -r --name-only --no-commit-id --diff-filter=A ` – Jakub Narębski Nov 17 '15 at 23:15
  • The `-r` option is present. I realized that I supplied the wrong commit hash, and `diff-tree` appears to work on the correct commit. But still, it's strange that it doesn't return anything for a certain commit, which clearly contains a change to a file: http://pastebin.com/ED0pHtf5 `-diff-filter` works like a charm - many thanks! – CodeManX Nov 17 '15 at 23:47
  • @CoDEmanX note that `git diff d730c6` shows difference between commit and your working area; use `git diff d730c6^!` or `git show d730c6` instead – Jakub Narębski Nov 18 '15 at 01:06
  • `git log --pretty="" --name-only` for me! – Pysis Sep 07 '21 at 19:19
  • sorry what is an example scenario where list of files in a commit are different than the list of files changed? I just kinda experienced this scenario but cannot pinpoint what's happening. – nanospeck Jun 06 '22 at 00:49
  • @nanospeck : all files in a commit mean all files in a project at a specific revision (specific commit); commit can have changed only subset of those files. – Jakub Narębski Jun 07 '22 at 01:33
  • The --diff-tree does not work after a merge – jav Dec 05 '22 at 12:43
  • i've noticed that `git ls-tree --name-only -r` shows more complete list of files for merge commit - it shows not only the files that were modified during merge commit, but actually all the files brought to repo from 2 branches that made that merge commit. – Max Jun 18 '23 at 04:05
309

I'll just assume that gitk is not desired for this. In that case, try git show --name-only <sha>.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Hank Gay
  • 70,339
  • 36
  • 160
  • 222
  • 42
    --name-only is plenty in most cases where i needed it; Therefore, upvoted the shortest solution (and the only one that i'd remember in 1 try). – Erik S Aug 01 '12 at 21:42
  • 1
    As someone who really likes CLI git, `gitk` is actually a decent way of reviewing the files and displaying the file that the diff is on. e.g. Code reviewing a monster commit from a peer. – Elijah Lynn Oct 27 '17 at 21:56
270

I personally use the combination of --stat and --oneline with the show command:

git show --stat --oneline HEAD
git show --stat --oneline b24f5fb
git show --stat --oneline HEAD^^..HEAD

If you do not like/want the addition/removal stats, you can replace --stat with --name-only

git show --name-only --oneline HEAD
git show --name-only --oneline b24f5fb
git show --name-only --oneline HEAD^^..HEAD
m13r
  • 2,458
  • 2
  • 29
  • 39
Tuxdude
  • 47,485
  • 15
  • 109
  • 110
  • 2
    Very nice. To define an alias: `alias gits='git show --stat --oneline'`, then `gits` by itself shows the latest changes (in HEAD), while `gits b24f5fb` can be used to show any revision's changes. – Brent Faust Dec 05 '13 at 03:03
  • 5
    One could also create a git alias... e.g. perhaps `git config --global alias.changes 'show --stat --oneline'`. Then you can type `git changes` (with an optional commit-ish) and get the output from the first examples above. – lindes Dec 05 '13 at 17:31
  • Git for Windows requires double quotes: `git config --global alias.changes "show --stat --oneline"` – Alchemistmatt Jul 25 '17 at 02:46
  • 3
    Nice. And unlike the accepted answer, `git show` also works for reviewing stashed changes: e.g. `git show --stat --oneline stash@{1}` – Jeff Ward Jul 26 '17 at 19:00
  • 1
    this is what I've really needed ! unlike " git diff-tree --name-status -r ", with this command I may see affected files in the merge too ! thanks ! – dobrivoje Feb 19 '19 at 11:02
131

You can also do

git log --name-only

and you can browse through various commits, commit messages and the changed files.

Type q to get your prompt back.

Indu Devanath
  • 2,068
  • 1
  • 16
  • 17
76

Recently I needed to list all changed files between two commits. So I used this (also *nix specific) command

git show --pretty="format:" --name-only START_COMMIT..END_COMMIT | sort | uniq

Or as Ethan points out:

git diff --name-only START_COMMIT..END_COMMIT

Using --name-status will also include the change (added, modified, deleted, etc.) next to each file:

git diff --name-status START_COMMIT..END_COMMIT
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
lunohodov
  • 5,179
  • 2
  • 25
  • 17
  • 5
    If you use `git diff --name-status START_COMMIT..END_COMMIT` then you don't need the trailing `|sort | uniq`. – Ethan Sep 17 '13 at 20:12
  • 1
    Correction to above comment: `git diff --name-only START_COMMIT..END_COMMIT` – Ethan Sep 17 '13 at 20:19
  • This is what I was looking for. How I used it: `git diff --name-only START_COMMIT..END_COMMIT | grep -v -e '**.png' -e '**.xml'`. I wanted a list of code changes only for a huge PR that had added thousands of PNGs and XML layouts. – AutonomousApps Sep 18 '17 at 16:39
72

Simplest form:

git show --stat (hash)

That's easier to remember and it will give you all the information you need.

If you really want only the names of the files you could add the --name-only option.

git show --stat --name-only (hash)

VaTo
  • 2,936
  • 7
  • 38
  • 77
52

I use the changed alias quite often. To set it up:

git config --global alias.changed 'show --pretty="format:" --name-only'

Then:

git changed (lists files modified in last commit)
git changed bAda55 (lists files modified in this commit)
git changed bAda55..ff0021 (lists files modified between those commits)

Similar commands that may be useful:

git log --name-status --oneline (very similar, but shows what actually happened M/C/D)
git show --name-only
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
takeshin
  • 49,108
  • 32
  • 120
  • 164
50

Use

git log --name-status

This will show you the commit id, message, the files changed and whether it was modified, created, added, or deleted. Somewhat of an all-in-one command.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
alpha_989
  • 4,882
  • 2
  • 37
  • 48
  • this brings up a huge list of every recent commit, I have to hold down the ENTER button to see everything, then it locks my cmd. no thanks. – john k Nov 22 '21 at 15:24
47

Try this command for name and changes number of lines

git show --stat <commit-hash>

Only show file names

git show --stat --name-only  <commit-hash>

For getting the last commit hash, try this command:

git log -1

Last commit with show files name and file status modify, create, or delete:

 git log -1 --oneline --name-status <commit-hash>

Or for all

git log

For more advanced git log information, read these articles:

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jignesh Joisar
  • 13,720
  • 5
  • 57
  • 57
46

Using the standard git diff command (also good for scripting):

git diff --name-only <sha>^ <sha>

If you also want the status of the changed files:

git diff --name-status <sha>^ <sha>

This works well with merge commits.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vicente Quintans
  • 1,396
  • 12
  • 21
36

To list the files changed on a particular commit:

git show --pretty=%gd --stat <commit_id>

To list the files changed on recent commit:

git show --pretty=%gd --stat
Prakash26790
  • 727
  • 9
  • 29
27
$ git log 88ee8^..88ee8 --name-only --pretty="format:"
Pat Notz
  • 208,672
  • 30
  • 90
  • 92
22

OK, there are a couple of ways to show all files in a particular commit...

To reduce the information and show only names of the files which committed, you simply can add --name-only or --name-status flag... These flags just show you the file names which are different from previous commits as you want...

So you can do git diff followed by --name-only, with two commit hashes after <sha0> <sha1>. Something like below:

git diff --name-only 5f12f15 kag9f02

I also created the below image to show all steps to go through in these situations:

git diff --name-only 5f12f15 kag9f02

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alireza
  • 100,211
  • 27
  • 269
  • 172
21
git show --name-only a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
Oleg Kokorin
  • 2,288
  • 2
  • 16
  • 28
19

Use a simple one-line command, if you just want the list of files changed in the last commit:

git diff HEAD~1 --name-only
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Developer-Sid
  • 1,372
  • 11
  • 9
17

There's also git whatchanged, which is more low level than git log

NAME
       git-whatchanged - Show logs with difference each commit introduces

It outputs the commit summary with a list of files beneath it with their modes and if they were added(A), deleted(D), or modified(M);

$ git whatchanged f31a441398fb7834fde24c5b0c2974182a431363

Would give something like:

commit f31a441398fb7834fde24c5b0c2974182a431363
Author: xx <xx@xx.nl>
Date:   Tue Sep 29 17:23:22 2015 +0200

    added fb skd and XLForm

:000000 100644 0000000... 90a20d7... A  Pods/Bolts/Bolts/Common/BFCancellationToken.h
:000000 100644 0000000... b5006d0... A  Pods/Bolts/Bolts/Common/BFCancellationToken.m
:000000 100644 0000000... 3e7b711... A  Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.h
:000000 100644 0000000... 9c8a7ae... A  Pods/Bolts/Bolts/Common/BFCancellationTokenRegistration.m
:000000 100644 0000000... bd6e7a1... A  Pods/Bolts/Bolts/Common/BFCancellationTokenSource.h
:000000 100644 0000000... 947f725... A  Pods/Bolts/Bolts/Common/BFCancellationTokenSource.m
:000000 100644 0000000... cf7dcdf... A  Pods/Bolts/Bolts/Common/BFDefines.h
:000000 100644 0000000... 02af9ba... A  Pods/Bolts/Bolts/Common/BFExecutor.h
:000000 100644 0000000... 292e27c... A  Pods/Bolts/Bolts/Common/BFExecutor.m
:000000 100644 0000000... 827071d... A  Pods/Bolts/Bolts/Common/BFTask.h
...

I know this answer doesn't really match "with no extraneous information.", but I still think this list is more useful than just the filenames.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Koen.
  • 25,449
  • 7
  • 83
  • 78
17

I use this to get the list of changed files in a merge commit

λ git log -m -1 --name-only --pretty="format:"
configs/anotherconfig.xml
configs/configsInRepo.xml

or

λ git log -m -1 --name-status --pretty="format:"
A       configs/anotherconfig.xml
M       configs/configsInRepo.xml
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Piotr Perak
  • 10,718
  • 9
  • 49
  • 86
16

I use this to get the list of modified files between two changesets:

git diff --name-status <SHA1> <SHA2> | cut -f2
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user135507
  • 169
  • 1
  • 2
  • Yeah but the status can be quite handy at well (for isntance, you might want to grep to display all files except those that have been deleted with something like ``git diff --name-status .. | grep ^[^D] | cut -f2`` – Pierre-Adrien Sep 17 '14 at 09:19
14

I like to use

git show --stat <SHA1>^..<SHA2>
Michael De Silva
  • 3,808
  • 1
  • 20
  • 24
14

I found a perfect answer to this:

git show --name-status --oneline <commit-hash>

So that I can know

  • which files were just modified (M)

  • Which files were newly added (A)

  • Which files were deleted (D)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ijaz Ahmad
  • 11,198
  • 9
  • 53
  • 73
13

I like this:

git diff --name-status <SHA1> <SHA1>^
skiphoppy
  • 97,646
  • 72
  • 174
  • 218
  • I think this gets the `A` & `D` (add and delete) file statuses backwards, because it's showing the diff from the specified commit to the previous commit, instead of the other way around. It should be `git diff --name-status ^ `. – Troy Gizzi Jan 03 '15 at 05:14
10

List the files that changed in a commit:

git diff --name-only SHA1^ SHA1

This doesn't show log messages, extra newlines, or any other clutter. This works for any commit, not just the current one.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Newtonx
  • 3,555
  • 2
  • 22
  • 13
10

Display the log.

COMMIT can be blank (""), the SHA-1 hash, or a shortened version of the SHA-1 hash.

git log COMMIT -1 --name-only

This will list just the files and is very useful for further processing.

git log COMMIT -1 --name-only --pretty=format:"" | grep "[^\s]"
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
thefreshteapot
  • 121
  • 1
  • 3
9

Only the file list (not even commit message):

git show --name-only --pretty=format:

E.g. open all changed files in your editor:

git show --name-only --pretty=format: | xargs "$EDITOR"
user2394284
  • 5,520
  • 4
  • 32
  • 38
  • This works perfectly however it only shows the last commit. If you want to target a specific commit see answer by @Ryan McGeary – Hamfri Jun 18 '20 at 10:05
  • @Hamfri: No, it doesn't only work for the last commit. It's just the default of `git show`. – user2394284 Sep 15 '20 at 14:26
7

There is a simple trick to view as a file listing. Just add : after the hash:

git show 9d3a52c474:

You can then drill in,

git show 9d3a52c474:someDir/someOtherDir

If you hit a file, you'll get the raw version of the file; which sometimes is what you want if you're only looking for a nice reference or key pieces of code (diffs can make everything a mess),

git show 9d3a52c474:someDir/someOtherDir/somefile

The only drawback of this method is that it doesn't easily show a tree of files.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
srcspider
  • 10,977
  • 5
  • 40
  • 35
  • It will not only find files changed in a commit, but all files that are in the tree of that commit. Great if you want that, but not so great if you want to see which files changed. – mihi Oct 13 '21 at 20:57
7

Perhaps I missed it did anyone mention if you want to augment the log x previous commits using the 'log' command to include the names of the files effected then add --name-only on the end.

so:

git log -n3

to see the last comments of the last 3 commits.

git log -n3 --name-only

to see the comments and files effected in the last 3 commits.

eklektek
  • 1,083
  • 1
  • 16
  • 31
6

A combination of git show --stat and a couple of sed commands should trim the data down for you:

git show --stat <SHA1> | sed -n "/ [\w]\*|/p" | sed "s/|.\*$//"

That will produce just the list of modified files.

Shawn J. Molloy
  • 2,457
  • 5
  • 41
  • 59
seanhodges
  • 17,426
  • 15
  • 71
  • 93
4

List all files in a commit tree:

git ls-tree --name-only --full-tree a21e610
Mendi Barel
  • 3,350
  • 1
  • 23
  • 24
3

If your commit happens to be at the initial HEAD position

git show HEAD@{0}

this should work fine.

Shawn J. Molloy
  • 2,457
  • 5
  • 41
  • 59
Bruce
  • 107
  • 5