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:

  • I can't git push recently, what happened to my Git?
  • git pre-push hook, don't run if is --tags
  • Run git add and commit on Openshift Server
  • Use Git's commit message cleanup mode from commit-msg hook
  • How to disable merge option in Eclipse Git?
  • Combining multiple GIT repositories while preserving all tags/branches
  • 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?

  • Git - why are double dashes needed when running a command on a deleted file?
  • Unable to commit to an empty git repo
  • Why do you need Gitosis or Gitolite?
  • Git + Jenkins Builds from hooks - remote branches across multiple servers
  • Why do I need hg update after hg pull while in git I'm doing only git pull
  • Git - Stash Full Commits
  • 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.