Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Caleb Hearth
Caleb Hearth

Posted on • Originally published atcalebhearth.com on

Ignore RuboCop Changes in git blame

Have you ever rungit blame, looked at the commit for a line, and seen some big refactoring or formatting commit? It’s so frustrating not to be able to find the useful context on changes when this happens. When adding StandardRB or RuboCop, or when making changes to your.rubocop.yml configuration, you’ll probably end up with a large commit like this that doesn’t include valuable context when spelunking history.

Enter.git-blame-ignore-revs. The format of the file is just a list of commit SHAs. The file will automatically cause GitHub to ignore the corresponding commit when in their blame view. You can also configure Git to ignore these commits by settingblame.ignoreRevsFile.

git config blame.ignoreRevsFile .git-blame-ignore-revs
Enter fullscreen modeExit fullscreen mode

One catch is that because git config is not part of the repository, each person using the repo will need to set this config on their own. Also note thatgit blame will error if the file isn’t present, so this is not a good candidate for global configuration.

Now,git blame and GitHub will ignore these big formatting commits. Never worry about mass reformatting again!

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Dungeon Webmaster, Open Sourcerer, and breakfast THAC0 enthusiast.https://pub.calebhearth.com/@caleb
  • Location
    Denver, CO
  • Education
    BS Software Engineering
  • Work
    Principal Engineer at Buoy Software
  • Joined

More fromCaleb Hearth

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp