DEV Community

Ramu Narasinga
Ramu Narasinga

Posted on

`.git-blame-ignore-revs` file in React vs Refine.

I wrote an in-depth article about .git-blame-ignore-revs file found in React source code, but in this article, let’s draw a comparison between React and Refine codebase’s .git-blame-ignore-revs.

Before you continue reading this article, I recommend you first read my article, .git-blame-ignore-revs to ignore bulk formatting changes, to understand what this file is about.

Let me first provide the code inside the files — .git-blame-ignore-revs

.git-blame-ignore-revs in React codebase

c998bb1ed4b3285398c9c7797135d3f060243c6a
fd2b3e13d330a4559f5aa21462e1cb2cbbcf144b
Enter fullscreen mode Exit fullscreen mode

I copied this above code from the file shown in the below image.

Image description

.git-blame-ignore-revs in Refine codebase

# Since version 2.23 (released in August 2019), git-blame has a feature
# to ignore or bypass certain commits.
#
# This file contains a list of commits that are not likely what you
# are looking for in a blame, such as mass reformatting or renaming.
#
# Run the following command to apply this file as the default ignore file.
#
# git config blame.ignoreRevsFile .git-blame-ignore-revs

# chore: format all files (#5684)
# https://github.com/refinedev/refine/pull/5684
# This commit updates the linter and formatter configuration and applies to all relevant files.
16eefc493da3e66a095a11d9dcbeff0ec64dca57
Enter fullscreen mode Exit fullscreen mode

This above code is picked from the .git-blame-ignore-revs file in Refine codebase as shown in the below image:

Image description

So let’s talk about differences, before you read further, try to come up with your own differences that you have identified.

The comment

I like the fact that there is a comment in Refine’s .git-blame-ignore-revs explaining what this file is about and also points to the PR that has all those formatting changes that can be safely ignored when looking to blame who wrote a line.

The reason why you do this is, if you have changed formatting all across the codebase, the blame overrides the original author’s line with your formatting and there’s no way you could tell when you use ‘blame’ feature in Git.

Numbers of revs ignored

There’s two commit hashes in React codebase and there is only 1 commit hash in Refine codebase.

About me:

Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.

I am open to work on interesting projects. Send me an email at ramu.narasinga@gmail.com

My Github — https://github.com/ramu-narasinga

My website — https://ramunarasinga.com

My Youtube channel — https://www.youtube.com/@thinkthroo

Learning platform — https://thinkthroo.com

Codebase Architecture — https://app.thinkthroo.com/architecture

Best practices — https://app.thinkthroo.com/best-practices

Production-grade projects — https://app.thinkthroo.com/production-grade-projects

References:

  1. https://github.com/facebook/react/blob/main/.git-blame-ignore-revs

  2. https://github.com/refinedev/refine/blob/main/.git-blame-ignore-revs

  3. https://medium.com/@ramunarasinga/git-blame-ignore-revs-to-ignore-bulk-formatting-changes-f20ac23e6155

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

If this article connected with you, consider tapping ❤️ or leaving a brief comment to share your thoughts!

Okay