git: change styling (whitespace) without changing ownership/blame?

后端 未结 5 1000
面向向阳花
面向向阳花 2020-11-29 04:15

We have a massive, ancient codebase that needs a lot of cleanup. We have always had coding standards and everyone has always tried to follow them, but they were not enforced

5条回答
  •  星月不相逢
    2020-11-29 04:21

    Building on Mario's answer, I would suggest git shame as a global git-alias:

    git config --global alias.shame 'blame -w -M'
    

    ...and use it instead of git-blame:

    git shame path/to/file
    

    To explain:
    - -w Ignores whitespace changes, so not to blame someone who re-indented the code
    - -M Detects lines that were moved or copied, and blames the original author

提交回复
热议问题