{"thread":{"id":"16710","subject":"characterizing commits","startedAt":"2008-12-13T08:28:12Z","lastAt":"2008-12-13T08:52:28Z","messageCount":2,"participants":["William Pursell","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"97787","messageId":"4943721C.7070200@gmail.com","threadId":"16710","inReplyTo":null,"subject":"characterizing commits","fromName":"William Pursell","fromEmail":"bill.pursell@gmail.com","sentAt":"2008-12-13T08:28:12Z","receivedAt":"2008-12-13T08:28:12Z","isPatch":false,"sender":{"key":"bill.pursell@gmail.com","avatar":"https://gravatar.com/avatar/3ab4313e5dfdc1fedb65206d829ba33f71f56f26e11326979d1b99d5e1c403c9?d=mp&s=160"},"body":"\nI have a desire to add metadata to commits to characterize\ntheir importance/type.  (Or I'd like another recommended\nmethod to achieve the following behavior).\n\nA lot of commits in any given project can be grouped into\ndifferent types.  eg, looking at the history for git,\nthere are a lot of merge commits, a lot of commits\nthat only touch gitk, a lot of 'auto-generated manpages',\na lot of 'typo in documentation' etc.  In my own\nprojects, I have a fairly high percentage of commits\nthat are trivial (eg whitespace only, typos, etc).\nWhat I'm after is the ability to do something like:\n\ngit log --group=!trivial\ngit log --group=importance:3+\n\nand only get the log for those commits that have been\nnot been classified \"trivial\" or that have a precedence\nof 3 or greater.\n\nFor example, I'd like the following work flow:\n\n$ git log --pretty=oneline\ne62bb07a6894d282cdc0fdba6c67ae2ecd086cbb 5\nb0986c6e8415c45e123e1838fbe8bf9e8518a90d 4\n89916e36bae3208a76c338e91508759787563042 3\n3942ef4e118dde3d844da5d84f466ac9666fae62 2\n6fa2e40ed491d1dcbbfac9f2d301b517413bec3b 1\n04dcd38a8cb6496e37594a273ca39542912ca1eb important\n9bd23c2d08e254058a1a9709f963737dc9a71d16 trivial change\n$ git group 6fa2e trivial\n$ git group 9bd23 trivial\n$ git log --pretty=oneline --group=!trivial\ne62bb07a6894d282cdc0fdba6c67ae2ecd086cbb 5\nb0986c6e8415c45e123e1838fbe8bf9e8518a90d 4\n89916e36bae3208a76c338e91508759787563042 3\n3942ef4e118dde3d844da5d84f466ac9666fae62 2\n04dcd38a8cb6496e37594a273ca39542912ca1eb important\n\nIs there already a mechanism for filtering\ncommits that I could extend to accomplish this?\n\n\n-- \nWilliam Pursell\n"},{"id":"97789","messageId":"20081213085228.GA20282@coredump.intra.peff.net","threadId":"16710","inReplyTo":"4943721C.7070200@gmail.com","subject":"Re: characterizing commits","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-12-13T08:52:28Z","receivedAt":"2008-12-13T08:52:28Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Dec 13, 2008 at 08:28:12AM +0000, William Pursell wrote:\n\n> A lot of commits in any given project can be grouped into\n> different types.  eg, looking at the history for git,\n> there are a lot of merge commits, a lot of commits\n> that only touch gitk, a lot of 'auto-generated manpages',\n> a lot of 'typo in documentation' etc.  In my own\n> projects, I have a fairly high percentage of commits\n> that are trivial (eg whitespace only, typos, etc).\n> What I'm after is the ability to do something like:\n> \n> git log --group=!trivial\n> git log --group=importance:3+\n>\n> [...]\n\n> Is there already a mechanism for filtering\n> commits that I could extend to accomplish this?\n\nGenerally you would put a pseudo-header into your commit message, like:\n\n  Status: trivial\n  Importance: 3\n\nand then use --grep to filter matching commits:\n\n  git log --grep=\"Status: trivial\"\n  git log --grep=\"Importance: [3-9]\"\n\nObviously the syntax is a little bit clunkier. You could fix that with\nan option to parse arbitrary pseudo-headers (and even support numeric\nrelations), something like:\n\n  git log --filter='importance > 3'\n\nwhich would be converted internally to a grep of the commit message like\nthis:\n\n  /^importance: (\\d+)/i\n\nand compare the result to 3.\n\nThe nice thing about that approach is that the storage remains the same:\ntext in the commit message. That means it gets displayed when you look\nat the commit, people with older versions of git can still read it, etc.\n\nOne thing this _doesn't_ get you is annotating commits after the fact.\nThis has been discussed in the past; try searching the list for \"notes\".\n\n-Peff\n"}]}