<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Using aliases — Bazaar 2.6.0 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.6.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/bzr.ico"/> <link rel="top" title="Bazaar 2.6.0 documentation" href="../index.html" /> <link rel="up" title="Bazaar User Guide" href="index.html" /> <link rel="next" title="Using plugins" href="plugins.html" /> <link rel="prev" title="Configuring Bazaar" href="configuring_bazaar.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="plugins.html" title="Using plugins" accesskey="N">next</a></li> <li class="right" > <a href="configuring_bazaar.html" title="Configuring Bazaar" accesskey="P">previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="../index.html">Table of Contents (2.6.0)</a> »</li> <li><a href="index.html" accesskey="U">Bazaar User Guide</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="using-aliases"> <h1>Using aliases<a class="headerlink" href="#using-aliases" title="Permalink to this headline">¶</a></h1> <div class="section" id="what-are-aliases"> <h2>What are aliases?<a class="headerlink" href="#what-are-aliases" title="Permalink to this headline">¶</a></h2> <p>Aliases are an easy way to create shortcuts for commonly-typed commands, or to set defaults for commands.</p> </div> <div class="section" id="defining-aliases"> <h2>Defining aliases<a class="headerlink" href="#defining-aliases" title="Permalink to this headline">¶</a></h2> <p>Command aliases can be defined in the <tt class="docutils literal"><span class="pre">[ALIASES]</span></tt> section of your <tt class="docutils literal"><span class="pre">bazaar.conf</span></tt> file. Aliases start with the alias name, then an equal sign, then a command fragment. Here’s an example ALIASES section:</p> <div class="highlight-python"><div class="highlight"><pre>[ALIASES] recentlog=log -r-3..-1 ll=log --line -r-10..-1 commit=commit --strict diff=diff --diff-options -p </pre></div> </div> <p>Here are the explanations of the examples above:</p> <blockquote> <div><ul class="simple"> <li>The first alias makes a new <tt class="docutils literal"><span class="pre">recentlog</span></tt> command that shows the logs for the last three revisions</li> <li>The <tt class="docutils literal"><span class="pre">ll</span></tt> alias shows the last 10 log entries in line format.</li> <li>the <tt class="docutils literal"><span class="pre">commit</span></tt> alias sets the default for commit to refuse to commit if new files in the tree are not recognized.</li> <li>the <tt class="docutils literal"><span class="pre">diff</span></tt> alias adds the coveted -p option to diff</li> </ul> </div></blockquote> </div> <div class="section" id="using-the-aliases"> <h2>Using the aliases<a class="headerlink" href="#using-the-aliases" title="Permalink to this headline">¶</a></h2> <p>The aliases defined above would be used like so:</p> <div class="highlight-python"><div class="highlight"><pre>% bzr recentlog % bzr ll % bzr commit % bzr diff </pre></div> </div> </div> <div class="section" id="rules-for-aliases"> <h2>Rules for aliases<a class="headerlink" href="#rules-for-aliases" title="Permalink to this headline">¶</a></h2> <blockquote> <div><ul class="simple"> <li>You can override a portion of the options given in an alias by specifying the new part on the command-line. For example, if you run <tt class="docutils literal"><span class="pre">lastlog</span> <span class="pre">-r-5..</span></tt>, you will only get five line-based log entries instead of 10. Note that all boolean options have an implicit inverse, so you can override the commit alias with <tt class="docutils literal"><span class="pre">commit</span> <span class="pre">--no-strict</span></tt>.</li> <li>Aliases can override the standard behaviour of existing commands by giving an alias name that is the same as the original command. For example, default commit is changed with <tt class="docutils literal"><span class="pre">commit=commit</span> <span class="pre">--strict</span></tt>.</li> <li>Aliases cannot refer to other aliases. In other words making a <tt class="docutils literal"><span class="pre">lastlog</span></tt> alias and referring to it with a <tt class="docutils literal"><span class="pre">ll</span></tt> alias will not work. This includes aliases that override standard commands.</li> <li>Giving the <tt class="docutils literal"><span class="pre">--no-aliases</span></tt> option to the bzr command will tell it to ignore aliases for that run. For example, running <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">--no-aliases</span> <span class="pre">commit</span></tt> will perform a standard commit instead, not do a <tt class="docutils literal"><span class="pre">commit</span> <span class="pre">--strict</span></tt>.</li> </ul> </div></blockquote> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Using aliases</a><ul> <li><a class="reference internal" href="#what-are-aliases">What are aliases?</a></li> <li><a class="reference internal" href="#defining-aliases">Defining aliases</a></li> <li><a class="reference internal" href="#using-the-aliases">Using the aliases</a></li> <li><a class="reference internal" href="#rules-for-aliases">Rules for aliases</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="configuring_bazaar.html" title="previous chapter">Configuring Bazaar</a></p> <h4>Next topic</h4> <p class="topless"><a href="plugins.html" title="next chapter">Using plugins</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/user-guide/using_aliases.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="plugins.html" title="Using plugins" >next</a></li> <li class="right" > <a href="configuring_bazaar.html" title="Configuring Bazaar" >previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="../index.html">Table of Contents (2.6.0)</a> »</li> <li><a href="index.html" >Bazaar User Guide</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2011 Canonical Ltd. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3. </div> </body> </html>