7

First off I'll just start with a very similar problem, and flag this as not a duplicate:

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

It's incredibly similar to what I'd like to do, but doesn't quite tell me what I need to know.

I've been configuring the IDE's in my team (PHPStorm) to include code styling so that we can deal with it automatically. I would like to run the code styler over our entire project, commit it and keep the original authors for each line. The solution given in the question I've provided above seems to very nearly do what I'd like, except that it relies on running some file or command at the same time in order to make the changes. Ideally I would like to manually make the changes (ie get the IDE to make all the changes) and then commit the changes without altering any of the original authors/blame.

I don't really wan't to write my own syntax parser as that seems like a lengthy endeavor and unfortunately I'm not incredibly familiar with the more complex functions of git and couldn't figure out how to do it.

Community
  • 1
  • 1
Max Colledge
  • 287
  • 1
  • 3
  • 9
  • Can't you use some plugin / code inspector to style the code on the go? I feel code styling should not be automated and should be reviewed by the coder. – Abdullah Khilji Jun 10 '22 at 16:26
  • Why not have the IDE run the formatter _before_ making the actual commit? – knittl Oct 19 '22 at 08:14
  • This is tricky. How to handle moved lines or moved lines? How to handle white space changes? How to handle a "formatting fix" that affects multiple lines by different authors? I'm sure there is a way, but it is going to be very very complicated. – knittl Oct 19 '22 at 08:15

0 Answers0