<!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.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="Filtered views" href="filtered_views.html" /> <link rel="prev" title="Switch –store" href="switch_store.html" /> </head> <body> <div class="related"> <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><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="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 <tt class="docutils literal"><span class="pre">shelf</span></tt> to achieve this. When you want to restore the changes later you can use <tt class="docutils literal"><span class="pre">unshelve</span></tt> 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-python"><pre>$ 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> <p>The <tt class="docutils literal"><span class="pre">shelve</span></tt> command interactively asks which changes you want to retain in the working tree:</p> <div class="highlight-python"><pre>$ 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> <p>If there are lots of changes in the working tree, you can provide the <tt class="docutils literal"><span class="pre">shelve</span></tt> 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 <tt class="docutils literal"><span class="pre">diff</span></tt> to confirm the tree has just the changes you expect:</p> <div class="highlight-python"><pre>$ 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> <p>Great - you’re ready to commit:</p> <div class="highlight-python"><pre>$ bzr commit -m "improve first sentence"</pre> </div> <p>At some later time, you can bring the shelved changes back into the working tree using <tt class="docutils literal"><span class="pre">unshelve</span></tt>:</p> <div class="highlight-python"><pre>$ bzr unshelve Unshelving changes with id "1". M description.txt All changes applied successfully.</pre> </div> <p>If you want to, you can put multiple items on the shelf. Normally each time you run <tt class="docutils literal"><span class="pre">unshelve</span></tt> 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"> <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> <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 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="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><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.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>