I unzipped an older "git-image" onto my git repository and most of the files have been changed. I would like to know which files remained untouched. How to list these files?
Asked
Active
Viewed 1,132 times
9
-
possible duplicate of [Make git status show unmodified/unchanged tracked files?](http://stackoverflow.com/questions/16307091/make-git-status-show-unmodified-unchanged-tracked-files) – Mureinik Jul 16 '15 at 07:17
-
Have the sets of files themselves changed? – Tim Biegeleisen Jul 16 '15 at 07:18
-
@Mureinik, okay, but where's the correct answer in that duplicate? – user3719454 Jul 16 '15 at 07:21
-
1I just deleted my `git ls-files --no-modified` answer. As you pointed out correctly, the `--no-modified` switch does in fact nothing. Sorry! – Boldewyn Jul 16 '15 at 09:44
2 Answers
12
I didn't find anything purely git, but with some bash it is possible:
( git ls-files --modified ; git ls-files ) | sort | uniq -u
explanation
git ls-files
lists all files tracked by gitgit ls-files --modified
lists all the modified files tracked by git- the rest is some bash scripting to remove the duplicates from both lists.

Aristotle Pagaltzis
- 112,955
- 23
- 98
- 97

Chris Maes
- 35,025
- 12
- 111
- 136
-
For a similar idea to show both modified and unmodified files in a format like `git status` see [this response](https://stackoverflow.com/a/59722589/411282). – Joshua Goldberg Mar 12 '23 at 16:24
0
Maybe, if you unzip a archive, you may also won't use git but unzip -u
? It echos (the name of) all updated files and you may extract the list with sed or something if you like...