how to undo all whitespace changes with git

后端 未结 4 918
挽巷
挽巷 2021-01-31 14:54

I have a git repo, where I replaced a lot of files locally.

git status now shows many many modified files.

Some are \"really modified\", others only differ by li

4条回答
  •  无人及你
    2021-01-31 15:10

    Windows Users - don't despair!

    1. Install the Windows Subsystem for Linux (select Ubuntu).
    2. Run WSL.
    3. Mount the drive that contains your repo. To access your C drive, execute cd /mnt/c.
    4. Change directory to your repo: cd repos/my-project
    5. Execute the command from Aristotle Pagaltzis's incredible answer:
    git diff -b --numstat \
    | egrep $'^0\t0\t' \
    | cut -d$'\t' -f3- \
    | xargs git checkout HEAD --
    
    1. Upvote Aristotle Pagaltzis's answer.

提交回复
热议问题