From 2a6235243644b61ba7671d9cca2be51c78acfe5b Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 10 Jan 2022 16:06:14 +0400 Subject: [PATCH 1/3] Add '.git-blame-ignore-revs' to the project --- .git-blame-ignore-revs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000000000..5634fc091829ea --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Set line width to 80 +4857ad58c1241b3d63d21a6880c989b85746c3dc From ab12d0b0feed94b7603128fc071c24ce43b0ddf6 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 10 Jan 2022 16:09:19 +0400 Subject: [PATCH 2/3] Add another commit to the list --- .git-blame-ignore-revs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 5634fc091829ea..1f31dda7e18261 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,5 @@ -# Set line width to 80 +# Set line width to 80. 4857ad58c1241b3d63d21a6880c989b85746c3dc + +# ESLint updates. +f63053cace3c02e284f00918e1854284c85b9132 From 5f1fd706b7e15857114f3469200c7d6546f1bb8e Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 26 Jan 2022 13:28:38 +0400 Subject: [PATCH 3/3] Add documentation section --- docs/contributors/code/git-workflow.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/contributors/code/git-workflow.md b/docs/contributors/code/git-workflow.md index 16db71ffc7127b..4e4e886f670a80 100644 --- a/docs/contributors/code/git-workflow.md +++ b/docs/contributors/code/git-workflow.md @@ -135,3 +135,21 @@ git push ``` The above commands will update your `trunk` branch from _upstream_. To update any other branch replace `trunk` with the respective branch name. + +## Miscellaneous + +### Git Archeology + +When looking for a commit that introduced a specific change, it might be helpful to ignore revisions that only contain styling or formatting changes. + +Fortunately, newer versions of `git` gained the ability to skip commits in history: + +``` +git blame --ignore-rev f63053cace3c02e284f00918e1854284c85b9132 -L 66,73 packages/api-fetch/src/middlewares/media-upload.js +``` + +All styling and formatting revisions are tracked using the `.git-blame-ignore-revs` file in the Gutenberg repository. You can use this file to ignore them all at once: + +``` +git blame --ignore-revs-file .git-blame-ignore-revs -L 66,73 packages/api-fetch/src/middlewares/media-upload.js +```