0

I have quite a specific problem.

I would like to add a formatter to a giant project, but that formatter will change the space/tabs convention in the project. Running it will cause massive changes, mainly because of the indentation change.

I don't really mind changing the indentation convention, but by doing that the whole project will get a commit which will pretty much look like "git init", a thing that will cause lots of issues. It'll mean that everytime a developer will look at the annotation they'll get an ambiguous log message, and have to look for previous commits to realise why the change was done.

tl;dr I was wondering if there is a way I can still commit changes, but make a "ghost" commit which won't show up for everybody. I know it can be a problem with how git hashes it's commits, but maybe there is a way to still do that change without "erasing" the latest commit message (maybe even in some sort of IDE to ignore commits? because that's how most developers get the annotation).

Roee
  • 34
  • 5
  • 1
    Does this answer your question? [git: change styling (whitespace) without changing ownership/blame?](https://stackoverflow.com/questions/4112410/git-change-styling-whitespace-without-changing-ownership-blame) – jonrsharpe Jan 25 '20 at 09:18
  • 1
    If by annotation you mean in e.g. IntelliJ, see https://www.jetbrains.com/help/idea/investigate-changes.html#annotate - you can set the whitespace etc. flags there, too. – jonrsharpe Jan 25 '20 at 09:24
  • @jonrsharpe the first link seems a bit like overkill to rewrite the commit history of a 5 years project (and also can be dangerous). But ignoring the whitespace changes really did the trick! Sounds like the right answer for me :) – Roee Jan 25 '20 at 09:29
  • Note that both options are covered in the duplicate. The accepted answer is the one that helped the OP most, it might not be the best one for you. – jonrsharpe Jan 25 '20 at 09:36
  • I don't really find the second link in the duplicate, but I tested the configuration after the change and it'll certainly do the trick. I will be able to change the entire project and annotate only the really interesting parts of the refactor. Thanks again!(would've ticked it as the correct answer if it was an answer) – Roee Jan 25 '20 at 09:42
  • That's just how to apply the flags to git blame in those other answers in JetBrains IDEs (which you don't mention in the question, that was just a guess) specifically. I'll add it over there for anyone else with the same setup. – jonrsharpe Jan 25 '20 at 09:44
  • Not using JetBrains, wanted to be ambiguous about the IDE to make the question more generic and to know if this option even exists. `blame -w` is awesome and I didn't know it exists or that IDEs support it :) – Roee Jan 25 '20 at 09:50

0 Answers0