News for hackers. Stuff that matters.
Re:Converting a Git repo from tabs to spaces (2016) by js2 on Friday May 02, 2025 @09:48AM (#43869714)
It does. See `--ignore-revs-file`:

https://git-scm.com/docs/git-blame

You can configure a default:

  git config blame.ignoreRevsFile .git-blame-ignore-revs
GitHub supports it too:

https://docs.github.com/en/repositories/working-with-files/u...

I'm really curious though. This is a feature you've wished for: have you never bothered to run `man git-blame`, `git blame --help`, or Google for it? Git has supported it for ages and it's a trivially easy feature to find. Using your own description:

https://www.google.com/search?hl=en&q=git%20skip%20commit%20...

Re:Converting a Git repo from tabs to spaces (2016) by IshKebab on Friday May 02, 2025 @10:37AM (#43870408)
It would be a lot more usable if you could put that info in the commit.
Re:Converting a Git repo from tabs to spaces (2016) by OptionOfT on Friday May 02, 2025 @10:44AM (#43870520)
That on its own is a security risk, as it would introduce means to hide a commit in the commit itself.

At least with the . file you have to make 2 separate transactions.

Re:Converting a Git repo from tabs to spaces (2016) by IshKebab on Friday May 02, 2025 @01:12PM (#43872428)
No it wouldn't. You would still be able to see the commit in logs and file histories and if you ran blame without the skipping option.
Re:Converting a Git repo from tabs to spaces (2016) by prepend on Friday May 02, 2025 @03:43PM (#43873913)
No. I don’t want the author to make that decision for me. I’d rather git record everything and then I can choose how to view or render it.

Different people have different view preferences.

Re:Converting a Git repo from tabs to spaces (2016) by jayd16 on Friday May 02, 2025 @10:16PM (#43876365)
Ok but why not both checked in and user settings with the user overriding the repo?
Re:Converting a Git repo from tabs to spaces (2016) by mbork_pl on Saturday May 03, 2025 @05:30AM (#43877887)
I would guess quit a few malware authors would also love such a feature.
Re:Converting a Git repo from tabs to spaces (2016) by mmastrac on Friday May 02, 2025 @09:56AM (#43869828)
I've been using Git since the early 2010s and this feature was released in Aug 2019 (https://github.blog/open-source/git/highlights-from-git-2-23...).

You don't think I looked for it for the first 7-8 years of using Git at least a few times and came up empty? Seems a little uncharitable. Hacker News is a place to learn about stuff, not be chided for missing a point note in a release.

Come on man, you've been using HN for almost as long as I have. Be curious, treat people's comments with charity, continue the life-long learning tradition.

Obligatory XKCD lucky 10,000 link: https://xkcd.com/1053/

Re:Converting a Git repo from tabs to spaces (2016) by js2 on Friday May 02, 2025 @10:13AM (#43870049)
You're right. My apologies. It wasn't meant as a critique. I've been using git even longer and my memory was that the feature had been there way before 2019. Time flies. Relevant commit:

https://github.com/git/git/commit/ae3f36dea16e51041c56ba9ed6...

Re:Converting a Git repo from tabs to spaces (2016) by xiaoyu2006 on Friday May 02, 2025 @11:42AM (#43871297)
I like how the length of the commit message is at the same order of magnitude as the commit itself.
Re:Converting a Git repo from tabs to spaces (2016) by keybored on Friday May 02, 2025 @10:22AM (#43870185)
Thanks. Git (proj.) commits can be an enjoyable read.
Re:Converting a Git repo from tabs to spaces (2016) by jayd16 on Friday May 02, 2025 @03:00PM (#43873516)
The annoying thing about git is that you can't really set this kind of stuff up globally for a project w/o digging into some custom hook solutions. They should really have some kind of default config file with all these things. I really don't understand why everything needs to be per user settings ONLY.
Re:Converting a Git repo from tabs to spaces (2016) by npendleton on Friday May 02, 2025 @07:45PM (#43875632)
Whoa, it looks like my old patch is getting fixed up properly now! We might be getting this feature https://lore.kernel.org/git/20250501214057.371711-4-gitster@...
Re:Converting a Git repo from tabs to spaces (2016) by McP on Friday May 02, 2025 @05:48PM (#43874889)
Nice to see ignore-revs getting some love :)

I originally wrote it because I wanted to do a mass-refactoring to llvm-project to change its weird naming convention and "it will mess up git blame" was an objection that was raised. Getting ignore-revs landed took many iterations over several months (thanks Barret!) and at the end of it I felt so drained that I didn't have the energy to do the mass refactoring I originally planned. Oh well. Maybe someday.

Re:Converting a Git repo from tabs to spaces (2016) by mabster on Friday May 02, 2025 @06:30PM (#43875150)
A big thank you! Blame history being correct is something i care quite a bit about and I always add one of these files when I do formatting changes. I think I'm probably the only developer on my teams with this configured on though haha!