4 ms·
I wish Git had a way to "skip" a commit for blame for mechanical changes like this. It's the one big shortcoming I keep running into. A commit should be able to
by mmastrac 1y ago
I wish Git had a way to "skip" a commit for blame for mechanical changes like this. It's the one big shortcoming I keep running into. A commit should be able to be marked as "blame-free" and git blame should then walk up to the parent commit.
It might be expensive to compute but man it would be so useful.
Edit: TIL about .git-blame-ignore-revs. I am the 1 in 10000 for this one today, thanks.
- joshstrange 1y ago`.git-blame-ignore-revs` is probably what you are looking for Example: https://gist.github.com/kateinoigakukun/b0bc920e587851bfffa98b9e279175f2 https://gist.github.com/kateinoigakukun/b0bc920e587851bfffa9...
- y-curious 1y agoMy one gripe with this is that devs need to point their IDE to the file in the IDE settings. When I implemented .git-blame-ignore-revs, I got a lot of people complaining about blame disappearing completely and I had to point them all to editing IDE settings
- js2 1y agoIt does. See `--ignore-revs-file`: https://git-scm.com/docs/git-blame 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/using-files/viewing-and-understanding-files#ignore-commits-in-the-blame-view 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%20for%20blame https://www.google.com/search?hl=en&q=git%20skip%20commit%20...
- mmastrac 1y agoI'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/ 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/ https://xkcd.com/1053/
- js2 1y agoYou'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/ae3f36dea16e51041c56ba9ed6b38380c8421816 https://github.com/git/git/commit/ae3f36dea16e51041c56ba9ed6...
- keybored 1y agoThanks. Git (proj.) commits can be an enjoyable read.
- xiaoyu2006 1y agoI like how the length of the commit message is at the same order of magnitude as the commit itself.
- IshKebab 1y agoIt would be a lot more usable if you could put that info in the commit.
- OptionOfT 1y agoThat 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.
- patrickthebold 1y agoIs .git-blame-ignore-revs what you are looking for?
- braiamp 1y ago`blame -w` ignores the ones that are described in the article.
- PhilipRoman 1y agogit-blame-ignore-revs is great, but ultimately a half measure. Replace blame with log -L
- kwk1 1y agoSee also `git blame -w`
- hannasm 1y agoEverybody else here has a fantastic solution to your complaint but wouldn't it be even better to think big here, and wish that stupid whitespace formatting issues weren't something that git was tokenizing to begin with?
- florbo 1y agoWhitespace is important for a myriad of reasons, so the implementation makes sense to me. However, I would love to see git have configuration surrounding syntax awareness. That's a huge undertaking, though, but one can dream.