<!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>Shelving Changes — Bazaar 2.7.0 documentation</title> <link rel="stylesheet" href="../_static/classic.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.7.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="search" title="Search" href="../search.html" /> <link rel="top" title="Bazaar 2.7.0 documentation" href="../index.html" /> <link rel="up" title="Bazaar User Guide" href="index.html" /> <link rel="next" title="Filtered views" href="filtered_views.html" /> <link rel="prev" title="Switch –store" href="switch_store.html" /> </head> <body role="document"> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="filtered_views.html" title="Filtered views" accesskey="N">next</a></li> <li class="right" > <a href="switch_store.html" title="Switch –store" 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 class="nav-item nav-item-0"><a href="../index.html">Table of Contents (2.7.0)</a> »</li> <li class="nav-item nav-item-1"><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" role="main"> <div class="section" id="shelving-changes"> <h1>Shelving Changes<a class="headerlink" href="#shelving-changes" title="Permalink to this headline">¶</a></h1> <p>Sometimes you will want to temporarily remove changes from your working tree and restore them later, For instance to commit a small bug-fix you found while working on something. Bazaar allows you to put changes on a <code class="docutils literal"><span class="pre">shelf</span></code> to achieve this. When you want to restore the changes later you can use <code class="docutils literal"><span class="pre">unshelve</span></code> to apply them to your working tree again.</p> <p>For example, consider a working tree with one or more changes made ...</p> <div class="highlight-default"><div class="highlight"><pre><span></span>$ bzr diff === modified file 'description.txt' --- description.txt +++ description.txt @@ -2,7 +2,7 @@ =============== These plugins -by Michael Ellerman +written by Michael Ellerman provide a very fine-grained 'undo' facility @@ -11,6 +11,6 @@ This allows you to undo some of your changes, -commit, and get +perform a commit, and get back to where you were before. </pre></div> </div> <p>The <code class="docutils literal"><span class="pre">shelve</span></code> command interactively asks which changes you want to retain in the working tree:</p> <div class="highlight-default"><div class="highlight"><pre><span></span>$ bzr shelve --- description.txt +++ description.txt @@ -2,7 +2,7 @@ =============== These plugins -by Michael Ellerman +written by Michael Ellerman provide a very fine-grained 'undo' facility Shelve? [yNfrq?]: y --- description.txt +++ description.txt @@ -11,6 +11,6 @@ This allows you to undo some of your changes, -commit, and get +perform a commit, and get back to where you were before. Shelve? [yNfrq?]: n Shelve 2 change(s)? [yNfrq?]', 'y' Selected changes: M description.txt Changes shelved with id "1". </pre></div> </div> <p>If there are lots of changes in the working tree, you can provide the <code class="docutils literal"><span class="pre">shelve</span></code> command with a list of files and you will only be asked about changes in those files. After shelving changes, it’s a good idea to use <code class="docutils literal"><span class="pre">diff</span></code> to confirm the tree has just the changes you expect:</p> <div class="highlight-default"><div class="highlight"><pre><span></span>$ bzr diff === modified file 'description.txt' --- description.txt +++ description.txt @@ -2,7 +2,7 @@ =============== These plugins -by Michael Ellerman +written by Michael Ellerman provide a very fine-grained 'undo' facility </pre></div> </div> <p>Great - you’re ready to commit:</p> <div class="highlight-default"><div class="highlight"><pre><span></span>$ bzr commit -m "improve first sentence" </pre></div> </div> <p>At some later time, you can bring the shelved changes back into the working tree using <code class="docutils literal"><span class="pre">unshelve</span></code>:</p> <div class="highlight-default"><div class="highlight"><pre><span></span>$ bzr unshelve Unshelving changes with id "1". M description.txt All changes applied successfully. </pre></div> </div> <p>If you want to, you can put multiple items on the shelf. Normally each time you run <code class="docutils literal"><span class="pre">unshelve</span></code> the most recently shelved changes will be reinstated. However, you can also unshelve changes in a different order by explicitly specifying which changes to unshelve.</p> <p>Bazaar merges the changes in to your working tree, so they will apply even if you have edited the files since you shelved them, though they may conflict, in which case you will have to resolve the conflicts in the same way you do after a conflicted merge.</p> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="switch_store.html" title="previous chapter">Switch –store</a></p> <h4>Next topic</h4> <p class="topless"><a href="filtered_views.html" title="next chapter">Filtered views</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/user-guide/shelving_changes.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <div><input type="text" name="q" /></div> <div><input type="submit" value="Go" /></div> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="filtered_views.html" title="Filtered views" >next</a></li> <li class="right" > <a href="switch_store.html" title="Switch –store" >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 class="nav-item nav-item-0"><a href="../index.html">Table of Contents (2.7.0)</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" >Bazaar User Guide</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2009-2011 Canonical Ltd. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9. </div> </body> </html>