Push Command

The Push command pushes changes from the local Git repository's master to the configured StarTeam Server view.

Arguments

<starteam connection string>
Connection string format:
[starteam://]<hostname>:<port>/<project name>[/<view name>][/<folder name>]
<directory>
Git working directory.

Options

--attach-label (-lbl) <label name>
Specifies a StarTeam Label to be applied to the pushed files. The Label can be either a View or Revision Label, but it must already exist on the Server. The value can be a placeholder (?) in which case, the user will be prompted to enter the Label Name.
--autoignore
Automatically select the commit paths in Git repository tree to ignore when commit has more than one parent.
--changepackage-name <changepackage name>
Over-ride the name of the Change Package.
--changerequest (-cr) <crID>
Choose StarTeam Change Request as Process Item during push to StarTeam Server.
--clear-active-pi
Clear the chosen Active Process Item upon a successful push.
--complete
Mark the chosen Process Item as complete upon a successful push.
--create <project connection url>
Create a new project on the remote StarTeam Server. URL should be of the format <hostname>:<port>/<project name>.
--deep (-d)
Performs a deep push that creates Change Packages in the StarTeam Server for each commit in the Git repository since the last push.
--help (-h)
Command usage text.
--ignore (-i) id1,id2
Ignore commit IDs when performing deep push if a commit has more than one parent.
--lock (-l)
Obtain a StarTeam lock on files/folders while pushing to StarTeam Server.
--metadata
Include Git commit metadata in the Change Set when performing a deep push.
--no-tags
Tags associated with a commit are pushed to StarTeam Server as Labels by default. This option is used to disable the feature.
--non-exclusive-lock (-x)
Obtain a non-exclusive lock on StarTeam Files/Folders being pushed.
--password (-p) <password>
StarTeam Password. If the password is not specified and has not been cached during previous commands then you will be prompted for a password.
--processitem (-pi) <type:piId>
Choose a StarTeam Process Item to use during push. Any valid Process Item type can be used. The value can also be a placeholder, (?), in which case, the user will be prompted to enter the Process Item Type and ID.
--quiet (-q)
Progress is not reported.
--requirement (-r) <reqID>
Choose StarTeam Requirement to use during push to StarTeam Server.
--set-active-pi
Set the chosen Process Item as Active upon a successful push.
--shallow
Performs a shallow push, creating just one Change Package in the StarTeam Server for all the commits in the Git repository since last push.
--task (-t) <tskID>
Choose a Task as Process Item during push to StarTeam Server.
--unlock
Unlock Files/Folders while pushing to StarTeam Server.
--username (-u) <username>
StarTeam user that will perform this operation. If the StarTeam User name is not specified during the fetch/pull/push, then the user that was specified during the clone will automatically be used.
--verbose (-v)
Verbose mode.

Example

To Push the latest changes from Git repository to StarTeam Server using the following command:

C:\gitdemo\Sample>git st push

To create a new Project on StarTeam Server from an existing Git repository, use the --create option.

The following example would create a new Project called TestProject on StarTeam Server and push the source code from the Git repository using the shallow option. The command has to be run from within Git working directory.

C:\gitdemo\ExampleGit> git st push --create starteam://10.150.1.12:49201/TestProject --shallow

Specifying Process Items

Process Items can be specified in one of the following ways:

  • The following push command will use ChangeRequest 6144 and set it as the Active Process Item:
    C:\Test\gitRepo> git st push -cr 6144 --set-active-pi

    Subsequent pushes will use ChangeRequest 6144 as process item:

    C:\Test\gitRepo> git st push
  • The following command will mark the active Change Request as Fixed and clear the Active Process Item on the workstation.
    C:\Test\gitRepo> git st push --complete --clear-active-pi
  • Associate push changes with ChangeRequest 5561:
    C:\gitdemo\Sample>git st push –cr 5561
  • Associate push changes with Task 5001:
    C:\gitdemo\Sample>git st push –t 5001
  • Associate push changes with Requirement 531:
    C:\gitdemo\Sample>git st push –r 531
  • Associate push changes with a custom type item Defect and id=531:
    C:\gitdemo\Sample>git st push –pi Defect:531
  • Associate push changes with ChangeRequest 5561 and mark it as complete:
    C:\gitdemo\Sample>git st push –cr 5561 --complete

For Out-of-View Process Items, specify the Project name and View name in front of the complete folder path. Separate the view path with a colon (:). For example, -cr MyProject/RootView:ChildView/SourceCode/37 specifies Change Request 37 in the SourceCode Folder of the ChildView View in the MyProject Project.

During execution, the process first assumes that the Process Item is in the current View, and it checks the current View to determine whether the full path corresponds to a folder path within that View. If the Process Item is not found in the current View, it is treated as an Out-of-View Process Item, and the search for the Process Item begins from the Project and View.

To associate push changes with Change Request 5561 in a different view, 11.0 release, and mark it as complete:

C:\gitdemo\Sample>git st push -cr Sample:Sample/11.0 Release/5561 --complete
Alternatively, StarTeam Process Items to use can be specified as part of a Git commit message. The subsequent push to StarTeam Server will recognize the Process Item to use from the commit messages.

Examples:

  • C:\gitdemo\Sample> git add
  • Specify using ChangeRequest 5651:
    C:\gitdemo\Sample> git commit –m “Fix for ChangeRequest:5651”
  • Specify using Task 5651:
    C:\gitdemo\Sample> git commit –m “Fix for Task:5651”
  • Specify using Requirement 5651:
    C:\gitdemo\Sample> git commit –m “Fix for Requirement:5651”
  • Push the above Git commit using the process item in the commit message:
    C:\gitdemo\Sample> git st push