Why can't I use git log –follow with –full-diff?

git log --follow <myfile> shows the git log for one file.

I’d like to see this log with all the changes (diffs) in this file. I try:

  • Is there an inverse to Git's octopus merge?
  • How can I revert multiple Git commits (already pushed) to a published repository?
  • git blame with commit details in emacs
  • Skip processing of Git revisions in post-receive hook that have already been previously processed
  • How to force Jenkins to rebuild a branch?
  • Retaining file permissions with Git
  • git log --full-diff --follow <myfile>

    But this fails with:

    fatal: --follow requires exactly one pathspec

    Why? How can I get the diff I wanted?

    Or maybe, is it a bug in git?

  • Unable to create a new hotfix in a gitflow
  • Using vim for git commit messages broken after updating janus
  • git deploy with submodules
  • How do I remove a submodule?
  • Team member added hundreds of megs to git
  • How to rebase one Git repository onto another one?
  • 2 Solutions collect form web for “Why can't I use git log –follow with –full-diff?”

    You can get it like this:

    git diff <file_path_relative_to_project_root>


    Took a while to understand this. Whenever
    git log -p <file> is used it shows the commits where ever the file was touched and diffs for the same file alone. That means if you want to follow the complete history of a file you can add –follow option and get to see the complete history.

    But when you enter this command:
    git log --full-diff -p file , it shows you all the commits where ever this file was touched plus now it not only shows diff for the specified file but also shows the diff’s for all the files that were touched in the commit. That means its giving you result for multiple files.

    If you try this command: git log help
    You’ll see that –follow option can only be used only for a single file so
    you can have a command like this:
    git log --follow -p file since it shows results for only single file.

    But it cannot be used with the following command:
    git log --full-diff --follow -p file as it shows results for multiple files and this query would result in an error.

    TL;DR version of Sahil’s answer:

    In git log, --full-diff doesn’t work with --follow, because “full” means “show all changed files”, and --follow works only with one file.

    Solution: use git log --follow -p <file>.

    Git Baby is a git and github fan, let's start git clone.