Make git undo any whitespace-only changes?

后端 未结 5 1421
清歌不尽
清歌不尽 2021-01-31 09:28

Is there an easy way to automatically do a git checkout on any file that only has whitespace changes? I\'m dealing with both Windows and some code generation that\'s run from Ec

5条回答
  •  生来不讨喜
    2021-01-31 09:51

    rumpel's answer was the right fix for me. I would just like to complete a bit :

    If your changes have been pushed

    Once you followed rumpel's procedure, do not push again on your branch. Github will ask you to pull before and you will get every whitespace diff again. Instead create a new branch from your current branch and push the new one :

    # From $mybranch
    git checkout -b $mybranch-v2
    git push --set-upstream origin $mybranch-v2
    

    Then on GitHub close and delete $mybranch

提交回复
热议问题