Reputation: 623
I create a tag in the repository, let's say v1.0.0. Later there are 2 commits: first one with some changes and second one with revert of that changes. I'd like to find all modified files after tagging. I tried:
git diff --name-only v1.0.0 master
but for git diff
there weren't any changes - files look the same. But I need to know which files were modified, even if that modification was reverted.
Upvotes: 3
Views: 1094
Reputation: 4419
I search on the internet for this question, and get nothing. Finally I use this method:
git log commit1..commit2 --format="" --name-only | sort | uniq
what's important, it works.
Upvotes: 3
Reputation: 4476
When a commit is reverted, the resulting diff would be the same as if the original commit would have never existed, and so the change would not exist anymore.
I think trying to see a reverted diff would give you a false diff of your code which would not make any sense.
If you actually want those changes (they didn't have to be reverted), you can revert the revert commit.
Upvotes: 0
Reputation: 83577
The closest solution is probably git log --oneline --stat v1.0.0..master
. This will print a list of commits, along with the files they touched:
b1be31 Revert "test commit"
fileA | 1 -
1 file changed, 1 deletion(-)
23faef another commit
fileB | 2 +
fileC | 3 +
2 files changed, 5 insertions(+)
0821dea test commit
fileA | 1 +
1 file changed, 1 insertion(+)
Since every commit is listed, reverted changes will be visible (twice, first the original commit, then the revert commit).
If you want only a list of file names, you'd have to filter this through some kind of script, but for getting a quick list it might be enough. If you start scripting, you might want to look at the plumbing commands to get something that is easier to parse...
Upvotes: 3
Reputation: 13833
From man git-diff
:
git diff [--options] <commit> <commit> [--] [<path>...]
This is to view the changes between two arbitrary <commit>.
So just need the name of this commit before the changes were made, and the commit in which the change were made, then you can run git diff commit1 commit2
.
Upvotes: -1