Git commit that doesn't override original authors in git blame

后端 未结 2 1900
猫巷女王i
猫巷女王i 2020-11-30 02:39

I\'ve used a perl script to modify all tab characters in a php git repository and changed them all to 4 spaces.

$ find -iname \\*.php -exec perl -pi -e \"s/\         


        
2条回答
  •  不知归路
    2020-11-30 03:01

    Thanks to wnoise on git: change styling (whitespace) without changing ownership/blame?, I came up with this to run an arbitrary filter on git history, so using this you could rewrite history to make it look like offending whitespace or other issues were never committed, leaving the original authors in tact but your code cleaned up: git filter-branch --tree-filter 'git diff-tree --name-only --diff-filter=AM -r --no-commit-id $GIT_COMMIT | php cleanup.php' HEAD

提交回复
热议问题