Using Shelves for Storing Local Changes
Join the DZone community and get the full member experience.
Join For FreeSuppose a brilliant idea strikes you, when it is too risky or too late in the process to try implementing it straight away… or you want to share a new version with your teammates, or have it reviewed. This is when IntelliJ IDEA’s version control integration helps you move part of your work out of the way so you can continue developing a safe version, while your pending changes are preserved as a shelveset for later use.
Let’s consider the following example: several classes in a package are changed, but you want to set aside only one of these files, in our case GraphBuilderImpl.java.You can see the changed files in the Local tab of the Changes tool window:
[img_assist|nid=992|title=|desc=|link=none|align=left|width=238|height=98]
Right-click the file you want to set aside, and choose Shelve Changes on the context menu:
[img_assist|nid=993|title=|desc=|link=none|align=left|width=345|height=235]
The
Shelve Changes dialog shows you all the contents of the changelist. The
file in question is already checked. If by chance you change your mind
and would like to put more files on the same shelf, you can do it right
here. Type the optional comment that will identify the new shelveset in
addition to its timestamp, and click the Shelve Changes button.
[img_assist|nid=994|title=|desc=|link=none|align=left|width=313|height=227]
Now, what happens when you click the Shelve Changes button? IntelliJ IDEA creates a shelveset, marks it with a timestamp and comment (if any), and displays in the Shelf tab of the Changes tool window.
Next, specify to which changelist you want the revisions restored. Choose one of the existing changelists, or create a new one.
[img_assist|nid=995|title=|desc=|link=none|align=left|width=383|height=235]
The revisions to be restored appear in the specified changelist in the Local tab of the Changes tool window. Now you can commit changes as you usually do it.
Opinions expressed by DZone contributors are their own.
Comments