diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..70971c5 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,8 @@ +# When making commits that are strictly formatting/style changes, add the +# commit hash here, so git blame can ignore the change. +# See docs for more details: +# https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile + +# Example entries: +# # initial black-format +# # rename something internal diff --git a/MANIFEST.in b/MANIFEST.in index dee45a2..d47a16d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -24,6 +24,8 @@ graft docs exclude docs/\#* exclude docs/man/*.1.gz +exclude .git-blame-ignore-revs + # Examples graft examples diff --git a/README.rst b/README.rst index 3e13610..9c0c89e 100644 --- a/README.rst +++ b/README.rst @@ -129,3 +129,18 @@ project that you might want to use: - `mypython `_ - `ptpython and ptipython ` - `xonsh ` + +Ignoring commits with git blame.ignoreRevsFile +============================================== + +As of git 2.23, it is possible to make formatting changes without breaking +``git blame``. See the `git documentation +`_ +for more details. + +To use this feature you must: + +- Install git >= 2.23 +- Configure your local git repo by running: + - POSIX: ``tools\configure-git-blame-ignore-revs.sh`` + - Windows: ``tools\configure-git-blame-ignore-revs.bat`` diff --git a/tools/configure-git-blame-ignore-revs.bat b/tools/configure-git-blame-ignore-revs.bat new file mode 100644 index 0000000..3fc3c01 --- /dev/null +++ b/tools/configure-git-blame-ignore-revs.bat @@ -0,0 +1,10 @@ +rem Other config options for blame are markUnblamables and markIgnoredLines. +rem See docs for more details: +rem https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile + +rem Uncomment below and rerun script to enable an option. +rem git config blame.markIgnoredLines +rem git config blame.markUnblamables + +git config blame.ignoreRevsFile .git-blame-ignore-revs +git config --get blame.ignoreRevsFile diff --git a/tools/configure-git-blame-ignore-revs.sh b/tools/configure-git-blame-ignore-revs.sh new file mode 100644 index 0000000..e1892ef --- /dev/null +++ b/tools/configure-git-blame-ignore-revs.sh @@ -0,0 +1,10 @@ +# Other config options for blame are markUnblamables and markIgnoredLines. +# See docs for more details: +# https://git-scm.com/docs/git-config#Documentation/git-config.txt-blameignoreRevsFile + +# Uncomment below and rerun script to enable an option. +# git config blame.markIgnoredLines +# git config blame.markUnblamables + +git config blame.ignoreRevsFile .git-blame-ignore-revs +git config --get blame.ignoreRevsFile