Skip to content

Commit

Permalink
ignore styling commits in git blame (#405)
Browse files Browse the repository at this point in the history
### Feature or Bug-fix
- Refactoring

### Detail
My recent PR #394 has a lot
of changes but all of these changes are to styles only and not the code
itself, this way the blame history for all the changed files is lost (it
will always blame me).

This PR adds the file`.git-blame-ignore-revs` which contains the id of
the styling commit and the command that you need to run once to fix the
blame history for you.

Also Github understands that file and will show the history correctly.

This PR is based on [this
article](https://www.stefanjudis.com/today-i-learned/how-to-exclude-commits-from-git-blame/)
and is suggested by Raul.

This file works for the whole repository, and in the future one only
needs to add ids of styling commits and the history will be preserved
correctly.

---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
AmrSaber authored Apr 11, 2023
1 parent fefc45c commit f26fc01
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Run this command to always ignore formatting commits in `git blame`
# git config blame.ignoreRevsFile .git-blame-ignore-revs

# Enforce frontend styling and remove dead code
fefc45c2cdc4d3107369c4d70210894d098a775c

0 comments on commit f26fc01

Please sign in to comment.