Andrew Grimm
Andrew Grimm

Reputation: 81631

How to specify path when doing git show on a merge commit

I've got a merge commit, and I can show the entirety of it using git show -m. However, if I want to only show the change for a subfolder or a path, how do I do it? I tried doing git show -m -- app/ but it didn't show anything, even though git show --stat indicates that there were merges going on in that part of the repository.

Upvotes: 1

Views: 226

Answers (1)

Krzysztof Krasoń
Krzysztof Krasoń

Reputation: 27496

You can use --relative for that:

git show -m --relative=app/

But it will show paths relative to the directory provided in the path:

--relative[=<path>]

When run from a subdirectory of the project, it can be told to exclude changes outside the directory and show pathnames relative to it with this option. When you are not in a subdirectory (e.g. in a bare repository), you can name which subdirectory to make the output relative to by giving a <path> as an argument.

Upvotes: 2

Related Questions