I want git to give me a list of files within a folder unedited since a given revision -
i’ve been working on project needs touch every view (so within app/views folder), there’s lot of views. given combination of bash , git, how can list of files haven’t committed edit since given revision?
there's neater way of doing this, think following works:
if last revision before changes fa1afe1
, can find files changed under app/views
with:
git diff --name-only fa1afe1 -- app/views
also, can see of files git tracking under app/views
with:
git ls-files app/views
now can find lines appear in output of 1 of commands using comm -3
, bash's process substitution syntax:
comm -3 <(git diff --name-only fa1afe1 -- app/views|sort) <(git ls-files app/views|sort)
(you might find clearer send output of 2 commands temporary files , use comm
rather use process substitution, since you'll have solution work /bin/sh
, may easier understand.)
this command show files deleted in changes since fa1afe1
, since files won't appear in output of git ls-files
. caveat, strictly speaking show files different between commit , now, miss files changed in 1 commit , reverted original content afterwards. if that's problem can use git log
--name-only
, appropriate formatting build list of changed files instead of git diff
.
Comments
Post a Comment