git log exclude renames

I can list commits for a file, even if it has been renamed or moved

git log --follow

However, I would like to “follow” the file, but only list commits where the file was actually changed. Something like

  • Checking for a dirty index or untracked files with Git
  • What is the safest way to correct the date of a future-dated commit in git, and what are the consequences?
  • How to download only a working directory of the AOSP source code without the entire repo history?
  • Git undo merge attempt
  • git: How do I get rid of “warning: CRLF will be replaced by LF” without disabling safecrlf?
  • How to delete something that was accidentally pushed
  • git log --follow --exclude-renames

  • Push to Remote URL with TortoiseGit
  • Cross-referencing commits in github
  • Jenkins and Git: Monitor specific folder on any branch
  • How to deploy to Heroku directly from my Gitlab repository
  • Any way to guarantee that a git user doesn't use fake account info when commiting and pushing?
  • How to create digital object identifier (DOI) for bitbucket repository?
  • 2 Solutions collect form web for “git log exclude renames”

    A bit like in “nicely display file rename history in git log”, you could add --name-status in order to:

    • not select (grep -v renames: status ‘Rxxx‘, while keeping addition ‘A‘ or modification ‘M‘)
    • still follow the file through its different name

    But that will still involve post-processing the git log command (with grep and/or sed) in order to get the output you want: there is no native ‘--exclude-renames‘-like option yet.

    git log --follow --name-status --oneline | sed 'h;N;/\nR/d;g'
    • copy commit line to hold space
    • read in second line
    • if line starting with R is found, delete pattern space and start next cycle,
      else copy hold space to pattern space

    thanks to jthill

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