git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] specify commit by negative pattern

From
Will Palmer <wmpalmer@gmail.com>
Date
Jun 3, 2015, 20:54 UTC
Message-ID
<1433364854-30088-1-git-send-email-wmpalmer@gmail.com>

add support for negative pattern matching in @^{/<pattern>} style revision specifiers. So now you can find the first commit whose message doesn't match a pattern, complementing the existing positive matching. e.g.:

    $ git rebase -i @^{/!^WIP}

My use-case is in having a "work, work, work, rebase, push"-style workflow, which generates a lot of "WIP foo" commits. While rebasing is usually handled via "git rebase -i origin/master", occasionally I will already have several "good, but not yet ready to push" commits hanging around while I finish work on related commits. In these situations, the ability to quickly "git diff @^{/!^WIP}" to get an overview of all changes "since the last one I was happy with", can be useful.

Reading through the history of this type of revision specifier, it feels like a negative match was always thought of as potentially useful someday, but didn't fit well with the original patch's limitations (namely: always searching across all refs).

Will Palmer (2):
  test for '!' handling in rev-parse's named commits
  object name: introduce '^{/!<negative pattern>}' notation
 Documentation/revisions.txt |  7 ++++---
 sha1_name.c                 | 22 ++++++++++++++++------
 t/t1511-rev-parse-caret.sh  | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 64 insertions(+), 10 deletions(-)
-- 
2.3.0.rc1
Next: Will Palmer
Message 1 of 7 in “specify commit by negative pattern”
  1. 0/2 specify commit by negative patternWill Palmer, Jun 3, 2015
  2. 1/2 test for '!' handling in rev-parse's named commitsWill Palmer, Jun 3, 2015
  3. Junio C HamanoJun 3, 2015
  4. Will PalmerJun 3, 2015
  5. Junio C HamanoJun 4, 2015
  6. Junio C HamanoJun 3, 2015
  7. 2/2 object name: introduce '^{/!<negative pattern>}' notationWill Palmer, Jun 3, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.