Commit be24814e authored by Jamie Tanna's avatar Jamie Tanna

Document how to list files changed in a commit

Closes #831.
parent e08f5404
Pipeline #103233942 passed with stages
in 9 minutes and 16 seconds
---
title: "List What Files Changed in a Git Commit"
description: "How to list what files changed in a given commit."
tags:
- blogumentation
- git
- command-line
license_code: Apache-2.0
license_prose: CC-BY-NC-SA-4.0
date: 2019-12-15T22:28:28+0000
slug: "git-files-changed"
image: /img/vendor/git.png
---
I've found in the past that it can be useful to know what files have changed in a given commit, i.e. to re-edit them, or to [add whitespace to the end of file]({{< ref "2019-09-02-newlines-all-git-files" >}}).
We can do this with the `diff-tree` subcommand, giving it a commit to look at, and it'll return a list of all files changed:
```sh
$ git diff-tree --no-commit-id --name-only -r HEAD
$ git diff-tree --no-commit-id --name-only -r e08f540464a6adbddda7de71b85fc793ddfac2a8
content/mf2/2019/12/ewhan.md
```
Taken from [_How to list all the files in a commit?_ on Stack Overflow](https://stackoverflow.com/a/424142).
---
posts:
- https://www.jvt.me/posts/2019/12/15/git-files-changed/
- https://www.jvt.me/posts/2019/12/10/chef-delete-files-not-list/
- https://www.jvt.me/posts/2019/12/10/node-jwk-to-x509-pem/
- https://www.jvt.me/posts/2019/12/06/jenkins-job-dsl-multibranch-external-script/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment