Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide standard linting commit #1746

Merged
merged 4 commits into from
Aug 4, 2022
Merged

Hide standard linting commit #1746

merged 4 commits into from
Aug 4, 2022

Conversation

StuAA78
Copy link
Contributor

@StuAA78 StuAA78 commented Jul 29, 2022

DEFRA/water-abstraction-team#37

This change creates a .git-blame-ignore-revs file containing the sha of the commit that switched from using ES Lint and semi-standard to plain old JS standard. This will hide this commit in git blame (given the correct config option) and in GitHub's blame view.

GitLens

If you use a tool such as GitLens which shows git blame info in the IDE, you can check its effect by first viewing a file which was changed, eg. src/lib/camel-case-keys.js:

image

Now pull down the branch and enter the following command in your water-abstraction-service folder to configure git blame to use .git-blame-ignore-revs:

git config blame.ignorerevsfile .git-blame-ignore-revs

Close and re-open the file and you'll see the output of git blame now ignores that commit:

image

Note that the configuration option will break git blame if you revert to a branch which doesn't have .git-blame-ignore-revs. You can remove it by running the following command in your water-abstraction-service folder:

git config --unset blame.ignorerevsfile

We recommend you don't set blame.ignorerevsfile globally as this will stop git blame from working for any folder which doesn't have a .git-blame-ignore-revs file! Better to set the option for each folder individually as and when they're updated with .git-blame-ignore-revs.

GitHub

The difference in GitHub's blame view can be seen here:

Before:
image

After:
image

@StuAA78 StuAA78 added enhancement New feature or request housekeeping Refactoring, tidying up or other work which supports the project labels Jul 29, 2022
@StuAA78 StuAA78 changed the base branch from develop to main August 1, 2022 14:25
@StuAA78 StuAA78 marked this pull request as ready for review August 4, 2022 15:39
@StuAA78 StuAA78 merged commit 0b45304 into main Aug 4, 2022
@StuAA78 StuAA78 deleted the git-blame-ignore-revs branch August 4, 2022 17:03
StuAA78 added a commit to DEFRA/water-abstraction-system that referenced this pull request Nov 27, 2024
[Our move away from Standard](#1476) has involved a huge number of changes. In order to preserve the `git blame` record, we create a `.git-blame-ignore-revs` file, which we can use to ignore specific commits. We previously introduced it to our other repos when implementing Standard:

DEFRA/water-abstraction-team#37
DEFRA/water-abstraction-service#1746

This PR creates the file for this repo with the required commit to ignore the large-scale linting changes.

Note that while GitHub supports this file, it's up to us to configure our local repo to make use of it. This can be done with:
```bash
git config blame.ignorerevsfile .git-blame-ignore-revs
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants