RubyMine 2017.1 Help

Shelving and Unshelving Changes

Shelving is temporarily storing pending changes you have not committed yet. This is useful, for example, if you need to switch to another high priority task and you want to set your changes aside to work on them later.

With RubyMine, you can shelve both separate files and entire changelists.

Once shelved, a change can ba applied as many times as you need by unshelving and subsequently restoring it on the shelf.

Shelving changes

  1. In the Local Changes tab of the Version Control tool window, select the files or a changelist you want to put to a shelf. On the main Version Control menu or on the context menu of the selection, choose Shelve changes.
  2. In the Shelve Changes dialog box, review the list of modified files and make sure that the files you are going to shelve have been checked out (for non-distributive version control systems).
  3. In the Commit Message field, enter the name of the shelf to be created and click the Shelve Changes button.

You can also shelve changes silently, without displaying the Shelve Changes dialog. To do this, select a file or a changelist you want to shelve, and click the Shelve Silently icon /help/img/idea/2017.1/shelve_silently_icon.png on the toolbar, or press Ctrl+Shift+N. The name of the changelist containing the changes you want to shelve will be used as the shelf name.

Unshelving changes

Unshelving is moving postponed changes from a shelf to a pending changelist. Unshelved changes can be filtered out from view or removed from the shelf.

  1. In the Shelf tab of the Version Control tool window, select a changelist or files you want to unshelve.
  2. If you want unshelved changes to be displayed, so that you can reapply them later if necessary, click the Show Already Unshelved /help/img/idea/2017.1/show_already_unsheved.png icon on the toolbar.
  3. Press Ctrl+Shift+U or choose Unshelve from the context menu of the selection.
  4. In the Unshelve Changes Dialog that opens, specify the changelist you want to restore the unshelved changes to in the Name field. You can select an existing changelist from the drop-down list or type a name for a new changelist to be created containing the unshelved changes. You can enter the description of the new changelist in the Comment field (optional).

    If you want to make the new changelist active, select the Set active option. Otherwise, the current active changelist remains active.

  5. If you want RubyMine to preserve the context of a task associated with the new changelist on its deactivation and restore the context then the changelist becomes active, select the Track context option (see Managing Tasks and Context for details.
  6. If you want to remove the changes you are about to unshelve, select the Remove successfully applied files from the shelf option.
  7. Click OK. If conflicts occur between the patched version and the current version, resolve them as described in Resolving Conflicts.

You can also unshelve changes silently, without displaying the Unshelve Changes dialog. To do this, select a file or a changelist you want to unshelve, and click the Unshelve Silently icon /help/img/idea/2017.1/unshelve_silently_icon.png on the toolbar, or press Ctrl+Shift+U. The unshelved files will be moved to the active pending changelist.

Restoring unshelved changes

RubyMine lets you reapply unshelved changes if necessary. All unshelved changes can be reused until they are removed explicitly by clicking the /help/img/idea/2017.1/clean_unshelved_changes.png icon on the toolbar, or selecting Clean Already Unshelved from the context menu.

To restore applied changes on the shelf do the following:

  1. Make sure that the Show Already Unshelved /help/img/idea/2017.1/show_already_unsheved.png toolbar option is enabled.
  2. Select the files or the shelf you want to restore.
  3. On the context menu of the selection, choose Restore.

Applying external patches

You can import patches created inside or outside RubyMine and apply them as shelved changes.

  1. In the Shelf tab of the Version Control tool window, choose Import Patches from the context menu.
  2. In the dialog box that opens, select the patch file to apply. The selected patch appears in the Shelf tab as a shelf.
  3. Select the newly added shelf with the patch and choose Unshelve Changes from the context menu of the selection.

Automatically shelving base revision

If you are using Git or Mercurial, it may be useful to have RubyMine always shelve base revisions of files that are under version control.

By default, RubyMine always "remembers" the last commit hash. However, this information is not sufficient if the history has been changed since the last commit as a result of running the rebase operation. In this case, having a copy of the base revision may help.

  1. Open the Settings dialog, and select the Version Control | Shelf node on the left.
  2. Select the Shelve base revisions of files under distributed version control systems option.

Modifying shelf location

By default, the shelf directory is located under your project directory. However, you may want to change the default shelf location. This can be useful , for example, if you want to avoid deleting shelves accidentally when cleaning up your working copy, or if you want to store them in a separate repository allowing shelves to be shared among your team members.

  1. Open the Settings dialog and select the Version Control | Shelf node on the left.
  2. Click the Change Shelves Location button and specify the new location in the dialog that opens.
  3. If necessary, select the Move shelves to the new location option to move existing shelves to the new directory.

See Also

Last modified: 23 March 2017