WIP : Chore: Setup Ruff formatter with git blame ignore#17
Draft
alexandremgo wants to merge 3 commits into
Draft
WIP : Chore: Setup Ruff formatter with git blame ignore#17alexandremgo wants to merge 3 commits into
alexandremgo wants to merge 3 commits into
Conversation
Only formatting changes
And ignores commit containing only formatting changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Just a demo of having a commit formatting several/all the files of a project (with Ruff), and managing to ignore it to display the previous git history.
The idea is to have a
.git-blame-ignore-revsfile that will contains the hashes of commits that ONLY contain formatting changes.As you can see in github docs this specific file name
.git-blame-ignore-revsis recognized by github.Also you can setup your local git with:
so it ignores automatically those commits. If you use a git blame tool in your IDE this should work too (tested quickly on VSCode, Intellij and neovim).
Demo
VSCode ex
After the changes, BEFORE setting up
.git-blame-ignore-revs:After the changes, AFTER setting up
.git-blame-ignore-revs:Github ex
You can also see the Github blame of a file: here for ex, and see that the
.git-blame-ignore-revsis taken into accountWarning
Careful to NOT squash and merge as the final commit will not have the same hash. Same for a rebase (but you can just update the
.git-blame-ignore-revsafter the rebase).Note
The default Ruff formatting rules or the presence of a
requirements-dev.txtare not final and should be discussed. This is mainly a demo of.git-blame-ignore-revs