After ten years of being a vivid house consumer, I made a decision to maneuver all my tasks to tabs. 😲
I utilized this variation to this weblog’s repository, and an issue got here to gentle. For those who change the formatting of lots of of information, you are messing along with your Git historical past.
git blame turns into fairly ineffective. Hundreds of strains can be marked with an unimportant formatting change.
I began googling round to learn the way to disregard commits in Git and VS code…
For those who use
git blame on the command line, the
--ignore-rev choice permits you to blame a file with out contemplating this nasty formatting commit.
git blame --ignore-rev a926bba49c index.js
That is nice however did not assist me as a result of I not often use
git blame on the command line, and even when I’d, I would not wish to all the time consider this argument.
I simply need
git blame to work.
I continued the CLI journey. It’s also possible to outline a file to specify all commits that must be ignored by
git blame with the
I created a
file (extra on this file identify later!)…
# Modified every part to tabs a926bba49c89a5b882cd298be3af2570b1e6252c
… and referenced the file when utilizing
git blame --ignore-revs-file .git-blame-ignore-revs index.js
This strategy works higher as a result of now I may add future commits to the revision file, and every time the ineffective commits stand in the way in which, I may use the
Nevertheless it’s not ultimate and it nonetheless did not work in VS Code.
To make issues work in VS Code, I added the
blame choice to my native git config.
git config blame.ignoreRevsFile .git-blame-ignore-revs
This command added a brand new entry to your native
[blame] ignoreRevsFile = .git-blame-ignore-revs
On the command line,
git blame then ignores the required commits robotically.
git blame index.js
And after restarting VS Code, it picked up the brand new Git config and did not present the formatting commit anymore! 🎉
Sadly, the described Git config choice is barely an area one. It will not make it to a different machine. That is why I adjusted the
git-blame-ignore-revs file with a small notice.
# Run this command to all the time ignore formatting commits in `git blame` # git config blame.ignoreRevsFile .git-blame-ignore-revs # Modified every part to tabs a926bba49c89a5b882cd298be3af2570b1e6252c
There’s most likely some tooling to streamline this course of; when you have concepts, please let me know!
And to shut issues: this is somewhat enjoyable truth. If the file holding your ignored commits is called
, GitHub picks it up robotically.
And that is it! When you have ideas or concepts on how you can cope with ineffective commits, ship them my approach!