Reputation: 311
git log -p .
only within the current directory but not in subdirectories
equivalent
svn log --diff --depth files .
Is it possible?
Upvotes: 9
Views: 2396
Reputation: 1233
Something like this will work:
git log --all --pretty=format: --name-only --relative="$(git rev-parse --show-prefix)" -- . | sed '/\//d ; /^[[:space:]]*$/d' | sort | uniq | xargs git log -p --
--relative
will remove files not from this directory and also remove the subdirectory prefix from the file names.git log -p
. The --
is needed otherwise it won't know what to do with the deleted files.It seems like an inefficient way of completing the task but I don't think git has the concept of "every file", it just has the current set of files and a list of diffs. So you have to go through every change set to get the complete list.
Upvotes: 0
Reputation: 61575
On Linux or the like you can list only the files in the current directory with:
ls -p | grep -v /
so:
git log -p `ls -p | grep -v /`
is one way to do it.
Upvotes: 1
Reputation: 42154
How about:
$ git log -p file1 file2 ...
Or, if they're too many to type:
$ find . -maxdepth 1 -type f | xargs git log -p
Upvotes: 3