<!doctype html> <html lang="en" class="no-js"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <link rel="canonical" href="https://martinvonz.github.io/jj/v0.9.0/revsets.html"> <link rel="prev" href="config.html"> <link rel="next" href="templates.html"> <link rel="icon" href="assets/images/favicon.png"> <meta name="generator" content="mkdocs-1.5.2, mkdocs-material-9.2.5"> <title>Revset language - Jujutsu docs</title> <link rel="stylesheet" href="assets/stylesheets/main.0e669242.min.css"> <script src="https://unpkg.com/iframe-worker/shim"></script> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback"> <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style> <script>__md_scope=new URL(".",location),__md_hash=e=>[...e].reduce((e,_)=>(e<<5)-e+_.charCodeAt(0),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script> </head> <body dir="ltr"> <script>var palette=__md_get("__palette");if(palette&&"object"==typeof palette.color)for(var key of Object.keys(palette.color))document.body.setAttribute("data-md-color-"+key,palette.color[key])</script> <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off"> <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off"> <label class="md-overlay" for="__drawer"></label> <div data-md-component="skip"> <a href="#revsets" class="md-skip"> Skip to content </a> </div> <div data-md-component="announce"> </div> <div data-md-color-scheme="default" data-md-component="outdated" hidden> </div> <header class="md-header md-header--shadow" data-md-component="header"> <nav class="md-header__inner md-grid" aria-label="Header"> <a href="." title="Jujutsu docs" class="md-header__button md-logo" aria-label="Jujutsu docs" data-md-component="logo"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg> </a> <label class="md-header__button md-icon" for="__drawer"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg> </label> <div class="md-header__title" data-md-component="header-title"> <div class="md-header__ellipsis"> <div class="md-header__topic"> <span class="md-ellipsis"> Jujutsu docs </span> </div> <div class="md-header__topic" data-md-component="header-topic"> <span class="md-ellipsis"> Revset language </span> </div> </div> </div> <label class="md-header__button md-icon" for="__search"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg> </label> <div class="md-search" data-md-component="search" role="dialog"> <label class="md-search__overlay" for="__search"></label> <div class="md-search__inner" role="search"> <form class="md-search__form" name="search"> <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required> <label class="md-search__icon md-icon" for="__search"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg> </label> <nav class="md-search__options" aria-label="Search"> <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg> </button> </nav> </form> <div class="md-search__output"> <div class="md-search__scrollwrap" data-md-scrollfix> <div class="md-search-result" data-md-component="search-result"> <div class="md-search-result__meta"> Initializing search </div> <ol class="md-search-result__list" role="presentation"></ol> </div> </div> </div> </div> </div> </nav> </header> <div class="md-container" data-md-component="container"> <main class="md-main" data-md-component="main"> <div class="md-main__inner md-grid"> <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" > <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0"> <label class="md-nav__title" for="__drawer"> <a href="." title="Jujutsu docs" class="md-nav__button md-logo" aria-label="Jujutsu docs" data-md-component="logo"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54Z"/></svg> </a> Jujutsu docs </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_1" > <label class="md-nav__link" for="__nav_1" id="__nav_1_label" tabindex="0"> <span class="md-ellipsis"> Getting started </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_1_label" aria-expanded="false"> <label class="md-nav__title" for="__nav_1"> <span class="md-nav__icon md-icon"></span> Getting started </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="install-and-setup.html" class="md-nav__link"> <span class="md-ellipsis"> Installation and Setup </span> </a> </li> <li class="md-nav__item"> <a href="tutorial.html" class="md-nav__link"> <span class="md-ellipsis"> Tutorial and Birds-Eye View </span> </a> </li> <li class="md-nav__item"> <a href="github.html" class="md-nav__link"> <span class="md-ellipsis"> Working with GitHub </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="FAQ.html" class="md-nav__link"> <span class="md-ellipsis"> FAQ </span> </a> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" > <label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0"> <span class="md-ellipsis"> Concepts </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false"> <label class="md-nav__title" for="__nav_3"> <span class="md-nav__icon md-icon"></span> Concepts </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="working-copy.html" class="md-nav__link"> <span class="md-ellipsis"> Working Copy </span> </a> </li> <li class="md-nav__item"> <a href="branches.html" class="md-nav__link"> <span class="md-ellipsis"> Branches </span> </a> </li> <li class="md-nav__item"> <a href="conflicts.html" class="md-nav__link"> <span class="md-ellipsis"> Conflicts </span> </a> </li> <li class="md-nav__item"> <a href="operation-log.html" class="md-nav__link"> <span class="md-ellipsis"> Operation Log </span> </a> </li> <li class="md-nav__item"> <a href="glossary.html" class="md-nav__link"> <span class="md-ellipsis"> Glossary </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--active md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" checked> <label class="md-nav__link" for="__nav_4" id="__nav_4_label" tabindex="0"> <span class="md-ellipsis"> Configuration </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="true"> <label class="md-nav__title" for="__nav_4"> <span class="md-nav__icon md-icon"></span> Configuration </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="config.html" class="md-nav__link"> <span class="md-ellipsis"> Settings </span> </a> </li> <li class="md-nav__item md-nav__item--active"> <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc"> <label class="md-nav__link md-nav__link--active" for="__toc"> <span class="md-ellipsis"> Revset language </span> <span class="md-nav__icon md-icon"></span> </label> <a href="revsets.html" class="md-nav__link md-nav__link--active"> <span class="md-ellipsis"> Revset language </span> </a> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class="md-nav__title" for="__toc"> <span class="md-nav__icon md-icon"></span> Table of contents </label> <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix> <li class="md-nav__item"> <a href="#symbols" class="md-nav__link"> Symbols </a> <nav class="md-nav" aria-label="Symbols"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#priority" class="md-nav__link"> Priority </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="#operators" class="md-nav__link"> Operators </a> </li> <li class="md-nav__item"> <a href="#functions" class="md-nav__link"> Functions </a> </li> <li class="md-nav__item"> <a href="#string-patterns" class="md-nav__link"> String patterns </a> </li> <li class="md-nav__item"> <a href="#aliases" class="md-nav__link"> Aliases </a> </li> <li class="md-nav__item"> <a href="#examples" class="md-nav__link"> Examples </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="templates.html" class="md-nav__link"> <span class="md-ellipsis"> Templating language </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" > <label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0"> <span class="md-ellipsis"> Comparisons </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="false"> <label class="md-nav__title" for="__nav_5"> <span class="md-nav__icon md-icon"></span> Comparisons </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="git-comparison.html" class="md-nav__link"> <span class="md-ellipsis"> Git comparison </span> </a> </li> <li class="md-nav__item"> <a href="git-compatibility.html" class="md-nav__link"> <span class="md-ellipsis"> Git compatibility </span> </a> </li> <li class="md-nav__item"> <a href="sapling-comparison.html" class="md-nav__link"> <span class="md-ellipsis"> Sapling </span> </a> </li> <li class="md-nav__item"> <a href="related-work.html" class="md-nav__link"> <span class="md-ellipsis"> Other related work </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" > <label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0"> <span class="md-ellipsis"> Technical details </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false"> <label class="md-nav__title" for="__nav_6"> <span class="md-nav__icon md-icon"></span> Technical details </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="technical/architecture.html" class="md-nav__link"> <span class="md-ellipsis"> Architecture </span> </a> </li> <li class="md-nav__item"> <a href="technical/concurrency.html" class="md-nav__link"> <span class="md-ellipsis"> Concurrency </span> </a> </li> <li class="md-nav__item"> <a href="technical/conflicts.html" class="md-nav__link"> <span class="md-ellipsis"> Conflicts </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_7" > <label class="md-nav__link" for="__nav_7" id="__nav_7_label" tabindex="0"> <span class="md-ellipsis"> Contributing </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_7_label" aria-expanded="false"> <label class="md-nav__title" for="__nav_7"> <span class="md-nav__icon md-icon"></span> Contributing </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="contributing.html" class="md-nav__link"> <span class="md-ellipsis"> Guidelines and "How to...?" </span> </a> </li> <li class="md-nav__item"> <a href="code-of-conduct.html" class="md-nav__link"> <span class="md-ellipsis"> Code of conduct </span> </a> </li> </ul> </nav> </li> <li class="md-nav__item md-nav__item--nested"> <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_8" > <label class="md-nav__link" for="__nav_8" id="__nav_8_label" tabindex="0"> <span class="md-ellipsis"> Design docs </span> <span class="md-nav__icon md-icon"></span> </label> <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_8_label" aria-expanded="false"> <label class="md-nav__title" for="__nav_8"> <span class="md-nav__icon md-icon"></span> Design docs </label> <ul class="md-nav__list" data-md-scrollfix> <li class="md-nav__item"> <a href="design/git-submodules.html" class="md-nav__link"> <span class="md-ellipsis"> git-submodules </span> </a> </li> <li class="md-nav__item"> <a href="design/git-submodule-storage.html" class="md-nav__link"> <span class="md-ellipsis"> git-submodule-storage </span> </a> </li> <li class="md-nav__item"> <a href="design/tracking-branches.html" class="md-nav__link"> <span class="md-ellipsis"> Tracking branches </span> </a> </li> </ul> </nav> </li> </ul> </nav> </div> </div> </div> <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" > <div class="md-sidebar__scrollwrap"> <div class="md-sidebar__inner"> <nav class="md-nav md-nav--secondary" aria-label="Table of contents"> <label class="md-nav__title" for="__toc"> <span class="md-nav__icon md-icon"></span> Table of contents </label> <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix> <li class="md-nav__item"> <a href="#symbols" class="md-nav__link"> Symbols </a> <nav class="md-nav" aria-label="Symbols"> <ul class="md-nav__list"> <li class="md-nav__item"> <a href="#priority" class="md-nav__link"> Priority </a> </li> </ul> </nav> </li> <li class="md-nav__item"> <a href="#operators" class="md-nav__link"> Operators </a> </li> <li class="md-nav__item"> <a href="#functions" class="md-nav__link"> Functions </a> </li> <li class="md-nav__item"> <a href="#string-patterns" class="md-nav__link"> String patterns </a> </li> <li class="md-nav__item"> <a href="#aliases" class="md-nav__link"> Aliases </a> </li> <li class="md-nav__item"> <a href="#examples" class="md-nav__link"> Examples </a> </li> </ul> </nav> </div> </div> </div> <div class="md-content" data-md-component="content"> <article class="md-content__inner md-typeset"> <h1 id="revsets">Revsets<a class="headerlink" href="#revsets" title="Permanent link">¶</a></h1> <p>Jujutsu supports a functional language for selecting a set of revisions. Expressions in this language are called "revsets" (the idea comes from <a href="https://www.mercurial-scm.org/repo/hg/help/revsets">Mercurial</a>). The language consists of symbols, operators, and functions.</p> <p>Most <code>jj</code> commands accept a revset (or multiple). Many commands, such as <code>jj diff -r <revset></code> expect the revset to resolve to a single commit; it is an error to pass a revset that resolves to more than one commit (or zero commits) to such commands.</p> <p>The words "revisions" and "commits" are used interchangeably in this document.</p> <p>The commits listed by <code>jj log</code> without arguments are called "visible commits". Other commits are only included if you explicitly mention them (e.g. by commit ID or a Git ref pointing to them).</p> <h2 id="symbols">Symbols<a class="headerlink" href="#symbols" title="Permanent link">¶</a></h2> <p>The <code>@</code> expression refers to the working copy commit in the current workspace. Use <code><workspace name>@</code> to refer to the working-copy commit in another workspace. Use <code><name>@<remote></code> to refer to a remote-tracking branch.</p> <p>A full commit ID refers to a single commit. A unique prefix of the full commit ID can also be used. It is an error to use a non-unique prefix.</p> <p>A full change ID refers to all visible commits with that change ID (there is typically only one visible commit with a given change ID). A unique prefix of the full change ID can also be used. It is an error to use a non-unique prefix.</p> <p>Use double quotes to prevent a symbol from being interpreted as an expression. For example, <code>"x-"</code> is the symbol <code>x-</code>, not the parents of symbol <code>x</code>. Taking shell quoting into account, you may need to use something like <code>jj log -r '"x-"'</code>.</p> <h3 id="priority">Priority<a class="headerlink" href="#priority" title="Permanent link">¶</a></h3> <p>Jujutsu attempts to resolve a symbol in the following order:</p> <ol> <li>Tag name</li> <li>Branch name</li> <li>Git ref</li> <li>Commit ID or change ID</li> </ol> <h2 id="operators">Operators<a class="headerlink" href="#operators" title="Permanent link">¶</a></h2> <p>The following operators are supported. <code>x</code> and <code>y</code> below can be any revset, not only symbols.</p> <ul> <li><code>x & y</code>: Revisions that are in both <code>x</code> and <code>y</code>.</li> <li><code>x | y</code>: Revisions that are in either <code>x</code> or <code>y</code> (or both).</li> <li><code>x ~ y</code>: Revisions that are in <code>x</code> but not in <code>y</code>.</li> <li><code>~x</code>: Revisions that are not in <code>x</code>.</li> <li><code>x-</code>: Parents of <code>x</code>.</li> <li><code>x+</code>: Children of <code>x</code>.</li> <li><code>::x</code>: Ancestors of <code>x</code>, including the commits in <code>x</code> itself.</li> <li><code>x::</code>: Descendants of <code>x</code>, including the commits in <code>x</code> itself.</li> <li><code>x::y</code>: Descendants of <code>x</code> that are also ancestors of <code>y</code>. Equivalent to <code>x:: & ::y</code>. This is what <code>git log</code> calls <code>--ancestry-path x..y</code>.</li> <li><code>::</code>: All visible commits in the repo. Equivalent to <code>all()</code>.</li> <li><code>:x</code>, <code>x:</code>, and <code>x:y</code>: Deprecated versions of <code>::x</code>, <code>x::</code>, and <code>x::y</code> We plan to delete them in jj 0.15+.</li> <li><code>x..y</code>: Ancestors of <code>y</code> that are not also ancestors of <code>x</code>. Equivalent to <code>::y ~ ::x</code>. This is what <code>git log</code> calls <code>x..y</code> (i.e. the same as we call it).</li> <li><code>..x</code>: Ancestors of <code>x</code>, including the commits in <code>x</code> itself, but excluding the root commit. Equivalent to <code>::x ~ root()</code>.</li> <li><code>x..</code>: Revisions that are not ancestors of <code>x</code>.</li> <li><code>..</code>: All visible commits in the repo, but excluding the root commit. Equivalent to <code>~root()</code>.</li> </ul> <p>You can use parentheses to control evaluation order, such as <code>(x & y) | z</code> or <code>x & (y | z)</code>.</p> <h2 id="functions">Functions<a class="headerlink" href="#functions" title="Permanent link">¶</a></h2> <p>You can also specify revisions by using functions. Some functions take other revsets (expressions) as arguments.</p> <ul> <li><code>parents(x)</code>: Same as <code>x-</code>.</li> <li><code>children(x)</code>: Same as <code>x+</code>.</li> <li><code>ancestors(x)</code>: Same as <code>:x</code>.</li> <li><code>descendants(x)</code>: Same as <code>x::</code>.</li> <li><code>connected(x)</code>: Same as <code>x::x</code>. Useful when <code>x</code> includes several commits.</li> <li><code>all()</code>: All visible commits in the repo.</li> <li><code>none()</code>: No commits. This function is rarely useful; it is provided for completeness.</li> <li><code>branches([pattern])</code>: All local branch targets. If <code>pattern</code> is specified, branches whose name contains the given string are selected. For example, <code>branches(push)</code> would match the branches <code>push-123</code> and <code>repushed</code> but not the branch <code>main</code>. If a branch is in a conflicted state, all its possible targets are included.</li> <li><code>remote_branches([branch_pattern[, [remote=]remote_pattern]])</code>: All remote branch targets across all remotes. If just the <code>branch_pattern</code> is specified, branches whose name contains the given string across all remotes are selected. If both <code>branch_pattern</code> and <code>remote_pattern</code> are specified, the selection is further restricted to just the remotes whose name contains <code>remote_pattern</code>. For example, <code>remote_branches(push, ri)</code> would match the branches <code>push-123@origin</code> and <code>repushed@private</code> but not <code>push-123@upstream</code> or <code>main@origin</code> or <code>main@upstream</code>. If a branch is in a conflicted state, all its possible targets are included.</li> <li><code>tags()</code>: All tag targets. If a tag is in a conflicted state, all its possible targets are included.</li> <li><code>git_refs()</code>: All Git ref targets as of the last import. If a Git ref is in a conflicted state, all its possible targets are included.</li> <li><code>git_head()</code>: The Git <code>HEAD</code> target as of the last import. Equivalent to <code>present(HEAD@git)</code>.</li> <li><code>visible_heads()</code>: All visible heads (same as <code>heads(all())</code>).</li> <li><code>root()</code>: The virtual commit that is the oldest ancestor of all other commits.</li> <li><code>heads(x)</code>: Commits in <code>x</code> that are not ancestors of other commits in <code>x</code>. Note that this is different from <a href="https://repo.mercurial-scm.org/hg/help/revsets">Mercurial's</a> <code>heads(x)</code> function, which is equivalent to <code>x ~ x-</code>.</li> <li><code>roots(x)</code>: Commits in <code>x</code> that are not descendants of other commits in <code>x</code>. Note that this is different from <a href="https://repo.mercurial-scm.org/hg/help/revsets">Mercurial's</a> <code>roots(x)</code> function, which is equivalent to <code>x ~ x+</code>.</li> <li><code>latest(x[, count])</code>: Latest <code>count</code> commits in <code>x</code>, based on committer timestamp. The default <code>count</code> is 1.</li> <li><code>merges()</code>: Merge commits.</li> <li><code>description(pattern)</code>: Commits with the given string in their description.</li> <li><code>author(pattern)</code>: Commits with the given string in the author's name or email.</li> <li><code>mine()</code>: Commits where the author's email matches the email of the current user.</li> <li><code>committer(pattern)</code>: Commits with the given string in the committer's name or email.</li> <li><code>empty()</code>: Commits modifying no files. This also includes <code>merges()</code> without user modifications and <code>root()</code>.</li> <li><code>file(pattern..)</code>: Commits modifying the paths specified by the <code>pattern..</code>. Paths are relative to the directory <code>jj</code> was invoked from. A directory name will match all files in that directory and its subdirectories. For example, <code>file(foo)</code> will match files <code>foo</code>, <code>foo/bar</code>, <code>foo/bar/baz</code>, but not file <code>foobar</code>.</li> <li><code>conflict()</code>: Commits with conflicts.</li> <li><code>present(x)</code>: Same as <code>x</code>, but evaluated to <code>none()</code> if any of the commits in <code>x</code> doesn't exist (e.g. is an unknown branch name.)</li> </ul> <h2 id="string-patterns">String patterns<a class="headerlink" href="#string-patterns" title="Permanent link">¶</a></h2> <p>Functions that perform string matching support the following pattern syntax.</p> <ul> <li><code>"string"</code>, <code>substring:"string"</code>: Matches strings that contain <code>string</code>.</li> <li><code>exact:"string"</code>: Matches strings exactly equal to <code>string</code>.</li> </ul> <h2 id="aliases">Aliases<a class="headerlink" href="#aliases" title="Permanent link">¶</a></h2> <p>New symbols and functions can be defined in the config file, by using any combination of the predefined symbols/functions and other aliases.</p> <p>For example:</p> <div class="highlight"><pre><span></span><code><span class="k">[revset-aliases]</span> <span class="s">'mine'</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">'author(martinvonz)'</span> <span class="s">'user(x)'</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">'author(x) | committer(x)'</span> </code></pre></div> <h2 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">¶</a></h2> <p>Show the parent(s) of the working-copy commit (like <code>git log -1 HEAD</code>):</p> <div class="highlight"><pre><span></span><code>jj log -r @- </code></pre></div> <p>Show commits not on any remote branch:</p> <div class="highlight"><pre><span></span><code>jj log -r 'remote_branches()..' </code></pre></div> <p>Show commits not on <code>origin</code> (if you have other remotes like <code>fork</code>):</p> <div class="highlight"><pre><span></span><code>jj log -r 'remote_branches(remote=origin)..' </code></pre></div> <p>Show all ancestors of the working copy (almost like plain <code>git log</code>)</p> <div class="highlight"><pre><span></span><code>jj log -r ::@ </code></pre></div> <p>Show the initial commits in the repo (the ones Git calls "root commits"):</p> <div class="highlight"><pre><span></span><code>jj log -r root()+ </code></pre></div> <p>Show some important commits (like <code>git --simplify-by-decoration</code>):</p> <div class="highlight"><pre><span></span><code>jj log -r 'tags() | branches()' </code></pre></div> <p>Show local commits leading up to the working copy, as well as descendants of those commits:</p> <div class="highlight"><pre><span></span><code>jj log -r '(remote_branches()..@)::' </code></pre></div> <p>Show commits authored by "martinvonz" and containing the word "reset" in the description:</p> <div class="highlight"><pre><span></span><code>jj log -r 'author(martinvonz) & description(reset)' </code></pre></div> </article> </div> </div> </main> <footer class="md-footer"> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class="md-copyright"> Made with <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener"> Material for MkDocs </a> </div> </div> </div> </footer> </div> <div class="md-dialog" data-md-component="dialog"> <div class="md-dialog__inner md-typeset"></div> </div> <script id="__config" type="application/json">{"base": ".", "features": [], "search": "assets/javascripts/workers/search.dfff1995.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": {"provider": "mike"}}</script> <script src="assets/javascripts/bundle.78eede0e.min.js"></script> </body> </html>