TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ignoring bulk change commits with Git blame (2019)

111 pointsby noway421almost 4 years ago

13 comments

BlackFingolfinalmost 4 years ago
I heartily recommend using `tig blame` from <a href="https:&#x2F;&#x2F;jonas.github.io&#x2F;tig&#x2F;" rel="nofollow">https:&#x2F;&#x2F;jonas.github.io&#x2F;tig&#x2F;</a> -- it allows you to interactively navigate the blame history; navigate to the line of interest, press one key to see details of the commit that last touched it. Not the right one? Press `,` to move to before that commit. Moving past bulk changes and finding the actual origin of a line of code is usually a breeze with this tool.<p>I don&#x27;t use tig much otherwise, but for this purpose I&#x27;ve not yet seen a better (and faster!) tool.
cassonmarsalmost 4 years ago
This is a dangerous feature for git repository hosts like GitHub to support. It makes it all too easy for subtle vulnerabilities to be introduced and omitted from visible blame history, with reviewers presuming trust based on historic content. Example: codebase went through an audit, was approved, then someone sneaks in some subtle changes to some files under the guise of a bulk change, adds the commit to the ignore list, continues making more commits to other files. Pulling a report to see historic changes could result in the file made vulnerable being skipped because it appeared to occur before the last audit. Hard pass.
评论 #27683747 未加载
评论 #27684177 未加载
评论 #27684930 未加载
评论 #27685702 未加载
评论 #27685724 未加载
yisspalmost 4 years ago
The one feature of perforce (which my current employer uses) that I miss going back to git is the &quot;time lapse&quot; view. It&#x27;s like git blame but you also have a slider that can scroll through the revisions to a file. This is sorta similar to that, but I still think p4&#x27;s version is still a better UX.
评论 #27684228 未加载
评论 #27685747 未加载
评论 #27685210 未加载
评论 #27684143 未加载
评论 #27684236 未加载
评论 #27685942 未加载
grandinjalmost 4 years ago
What I do, is I run loop like<p>(1) git blame &lt;file&gt; (2) git blame &lt;uninterestinghash&gt;^ &lt;file&gt;<p>which tells blame to go back to before the hash and do the blame.<p>I run that loop repeatedly, picking the most recent hash each time (by date&#x2F;time), until I get back to the change that interests me.
评论 #27686339 未加载
评论 #27686582 未加载
Tempest1981almost 4 years ago
Also discussed here a few days ago:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27643608" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=27643608</a>
rektidealmost 4 years ago
current $job has been switching to prettier &amp; among many other changes we&#x27;ve been doing the (one true wayl tabs to (ignoble cowardly top-down-force) spaces.<p>I added generating a .gitignorerevs file during these conversion to our process document. what sucks egg though is that there&#x27;s no standard for what to name these files. there&#x27;s no out of box support. there was a confusing nasty mess of a thread for how to modify vscode&#x27;s ultra-popular git lens plugin to add a git ignore revs file but 70% of the advertised &quot;works for me&quot; threads were wrong. in multiple ways often. we never found how to open the gui screenshots folks were showing to modify blame arguments; we had to resort to json modification which scared the crap out of some weakling junior devs with shitty constitution. the use of ${workingDir} or whatever in the config never worked, as other people latter pointed out. it wasn&#x27;t clear what we needed in the json. it was a bloody nightmare. just for the very first medium grade engineer I tried getting this working with.<p>holy shit I wish git would normalize a --ignore-revs-file so bad.<p>to those wringing pearls about how this is a vector for people to sneak changes in: tool up. build safeguards. holy shit the complaining &amp; fear &amp; uncertainty &amp; doubt over basic stuff, as if we can&#x27;t see these changes happening, as if everyone is a hapless idiot who can&#x27;t notice... I fear the society of losers your attitude suggests. just get better. write tools to notice these changes. which you would already, if you look at your git pulls. I do.
WalterGRalmost 4 years ago
We need semantic diff.
评论 #27684113 未加载
评论 #27687794 未加载
noway421almost 4 years ago
A friend of mine recently been mentioning that it is possible to hide bulk changes when introducing a linter to a repository. This is how! Thought it&#x27;s very useful and not well known.
remirkalmost 4 years ago
If you&#x27;re interested in who added, modified or deleted a line you could also use the git pickaxe.<p>&gt; git log -S&quot;Hello World&quot;<p>shows you all commits that either introduced, or deleted &#x27;Hello World&#x27;.
makeitdoublealmost 4 years ago
This looks like a worthwile change, helping in specific situations, when used sparsely.<p>Personally I see bulk changes as something that is legitimate change and should appear in the blame history, the same way refactorings are supposed to be functionnaly equivalent but we all know it’s not that easy and need to keep an eye on when they were done.<p>Having massive commits clutter history also looks like a good incentive to avoid massive commits in the first place.
chxalmost 4 years ago
Or you can just run git blameall and see the complete history at once. <a href="http:&#x2F;&#x2F;1dan.org&#x2F;git-blameall&#x2F;" rel="nofollow">http:&#x2F;&#x2F;1dan.org&#x2F;git-blameall&#x2F;</a> still have no idea why this is not more popular &#x2F; core.
erik_seabergalmost 4 years ago
I’m glad this tooling is improving, but it’s better not to need it. If a trusted contributor has a good reason to rewrite a bunch of code, that is the appropriate time to reformat it; the best bots don’t compare to anyone on my team.
gregorylalmost 4 years ago
Having a look around, this seems a bit unsupported by the common git tools (github, gitlab, ado etc), but otherwise incredibly useful, going to push this into a repo we recently hammered with a `prettier` format!