How do I run a code formatter over my source without modifying git history?

后端 未结 5 1750
日久生厌
日久生厌 2020-11-30 10:35

I am trying to format an entire repo using a code formatter tool. In doing so, I want to keep information about who committed which line, so that commands like git bla

5条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 10:56

    Mercurial has an (experimental) option for this, "--skip":

    --skip 
        revision to not display (EXPERIMENTAL)
    

    I think there is no equivalent yet in default git, but there is a hyper-blame command developed externally.

    A similar option (--ignore-rev and --ignore-revs-file is available in git since 2.23: https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revltrevgt.

    In my experience, both don't deal really well with formatting changes, especially when multiple lines are folded into one.

提交回复
热议问题