You should just be able to use the commit IDs. For example:
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT 218d182e 3ef44d29d
If you want to include the changes in commit 3ef44d29d
then you need to specify its parent either by ID or with 3ef44d29d^
.
Here are some examples, from one of my own projects. Going backwards in history, I have the following commits:
1a443
fb4ae
88226
c46ba
I get the following output from various commands:
$ git diff-tree -r --name-only 1a443
1a443831fa9f797fedb397e900bd3d45e2093ea6
public/customers.en.html
$ git diff-tree -r --name-only fb4ae
fb4ae4af0ac473b8547ec1717d4b4172c0d634f4
public/checkout.en.html
$ git diff-tree -r --name-only 88226
88226fec6f1082b1dffd266d3e1bd0dc38cca520
public/finish.en.html
$ git diff-tree -r --name-only c46bac
c46bacddee7785599c2f026f53cd93357e8ad30d
public/index.php
I can get all the changes between c46bac
and 1a443
easily enough:
$ git diff-tree -r --name-only c46bac 1a443
public/checkout.en.html
public/customers.en.html
public/finish.en.html
But notice that it doesn't include the change to public/index.php
in commit c46bac
. What we really want is to use the parent of that commit as our starting point for comparison.
$ git diff-tree -r --name-only c46bac^ 1a443
public/checkout.en.html
public/customers.en.html
public/finish.en.html
public/index.php