Export (0) Print
Expand All

Shelve Command

Stores a set of pending changes, together with pending check-in notes, a comment, and a list of associated work items, on the Team Foundation Server without actually checking them into the source control server.


tf shelve  [/replace] [/comment:(@commentfile|"comment")] [shelvesetname[;owner] [/validate]

tf shelve [/move] [/replace] [/comment:(@commentfile|"comment")] 
[/recursive] shelvesetname[;owner] filespec [/validate]

tf shelve /delete [/server:servername] shelvesetname[;owner] [/validate]

Parameters

Argument Description

commentfile

Specifies a file system path of a file from which comments for the shelveset should be read.

comment

Specifies the comment for the shelveset.

servername

The user-provided value for the /server option.

itemspec

Identifies the files or folders to shelve. By default, all pending changes in the current workspace are shelved if this parameter is not specified. For more information about how Team Foundation parses itemspecs to determine which items are within scope, see Command-Line Options.

shelvesetname

Specifies a name by which the shelveset can be retrieved from the Team Foundation server. You can specify an existing combination of shelvesetname and owner but only if /replace is also specified.

You must provide a value for this parameter.

owner

Identifies the current or intended owner of the shelveset by user name. By default, the current user is assigned ownership of the shelveset if one is not specified.

Option Description

/move

Removes pending changes from the workspace after the shelve operation is successful.

/replace

Replaces the existing shelveset with the same name and owner as the one that you specify.

/delete

Deletes the specified shelveset. Only the /server option may be combined with this option. If you do not include the /noprompt option, a confirmation message appears when the /delete option is specified.

/comment

Adds a specified comment describing the shelved changes.

/recursive

Shelves all items in the specified shelveset folder, its subfolders and all items therein if the itemspec you provide is a folder.

/server

Specifies the Team Foundation source control server in which to create, modify, or delete the specified shelveset.

/noprompt

Suppresses any prompts for input from you.

/validate

Only valid when not combined with /noprompt.

This option selects the validation check box in the Shelve - Source Files dialog box when it opens. When the validation check box is selected, the dialog box will evaluate the check-in policies and verify that require check-in notes have been filled in. This option is useful when the changes are being handed off for review and check-in by someone else.

The shelve command of the tf command-line utility backs up pending changes, a list of associated work items, in-progress check-in notes, and comments in a shelveset on the Team Foundation Server. A shelveset is much like a changeset that is not committed to the server. Like a changeset, a shelveset can be retrieved from the server into a local workspace by any user who has sufficient permissions.

Shelving is an alternative to checking in pending changes that have not been tested sufficiently. Use shelving when you want to interrupt you work:

  • Share a set of local working files together with another developer or tester without checking in your changes to the source control server.

  • Set aside a group of pending changes temporarily without checking them in so that you can instead work on a higher priority issue. After you complete work on the high priority task, you can restore your shelved changes using the Unshelve Command.

If you include the /move option, the shelve command rolls back all shelved file revisions to their base workspace versions that is the last version retrieved from the server to the current workspace. Specifically, the /move option makes sure that for all the items that you shelve:

  • Uses Undo to undo the changes that were shelved. The files that were pending additions are deleted from the source workspace.

  • Pending deletions are re-added to the source workspace.

  • The base workspace versions of all files for which pending editions exist are retrieved from the server into the current workspace.

  • All items in the current workspace are marked read-only.

If you include the /delete option, Team Foundation permanently removes the specified shelveset from the Team Foundation server.

The following example creates a new shelveset on the Team Foundation Server called Reflector_BuddyTest, assigns ownership to the user Hans, and then returns all items in the current workspace to the last gotten version and a read-only state.

c:\projects> tf shelve Reflector_BuddyTest;Hans /move

The following example deletes the existing shelveset, "new-feature" from the server, creates a new shelveset by that name, and retains all pending changes in the current workspace.

c:\projects> tf shelve new-feature /replace

The following example creates a shelveset named HelloWorld_TestMe that includes all pending changes to all .cs files in the C:\projects working folder and its subfolders.

c:\projects> tf shelve HelloWorld_TestMe c:\projects\*.cs /recursive

The following example deletes the HelloWorld_24 shelveset.

c:\projects> tf shelve HelloWorld_24 /delete

To use the shelve command you must be a shelveset owner, or have the Administer shelved changes permission set to Allow. For more information, see Team Foundation Server Permissions.

Community Additions

ADD
Show:
© 2014 Microsoft