Push command

The Push command pushes changes from the local Git repository's master and its branches to the configured StarTeam Server view. Git offers different push policies using the config option push.default which decides which branches will be pushed. Refer to Git documentation for more information on the push policies ( https://git-scm.com/docs/git-config )

Supported Git push command options:

 --dry-run(-n)
 --tags
 --force

Usually, the Git push command refuses to update StarTeam view if there are new changes on StarTeam that have not been pulled in yet. This flag disables these checks, and can cause work on the StarTeam view to be overwritten.

--push-option=<option> (-o <option> )

Additional push options specific to StarTeam can be pushed from command line using the -push-option.

Examples of push

C:\gitdemo\Sample > git push

The above command would push all the changes from the master branch and the matching local branches (depending upon the push policy) to the StarTeam Server.

C:\gitdemo\Sample > git push origin master

The above command would push only the changes from the master branch to the mapped StarTeam view.

C:\gitdemo\Sample >git push origin HEAD

The above command pushes the current branch to the corresponding view on the StarTeam Server.

GUID-F1AA69AF-6EFD-4446-9E3C-7D054B248F9D-low.png

The Process Item dialog opens by default during a Git push to StarTeam view. The user can select the appropriate process item to be linked with the push. The process item can be in the same view or an out-of-view item. The dialog in addition offers options to mark the process item fixed upon push. The user could also choose lock status during push.

The dialog box can be disabled by setting the following Git configuration (in .git\config file):

[Git-st "server"]
scm-server = starteam://Administrator@localhost:49204/Test1/Test1/
processItemPrompt = false

Using --push-option (-o) option

Associate push changes with ChangeRequest 5561 :

C:\gitdemo\Sample>git push -o changerequest=165
 C:\gitdemo\Sample>git push -o cr=165

Associate push changes with Task 5001 :

C:\gitdemo\Sample> git push -o task=5001
C:\gitdemo\Sample>git push -o t=5001

Associate push changes with Requirement 531:

C:\gitdemo\Sample>git push -o requirement=531
C:\gitdemo\Sample>git push -o r=531 -o set-active-pi

The set-active-pi would set the requirement 531 as an active process item so it can be used for future pushes. To clear the active process item, use -o clear-active-pi

The following command would use the active process item set for the push and would clear it at the end of the push.

C:\gitdemo\Sample>git push -o r=531 -o clear-active-pi

Associate push changes with a custom type item Defect and id=531 :

C:\gitdemo\Sample>git push -o pi=Defect:531

Associate push changes with ChangeRequest 5561 and mark it as complete:

C:\gitdemo\Sample>git push -o cr=5561 -o complete

Choose any valid StarTeam Process Item to use during push . Any valid Process Item type can be used. The process item could be a custom component too. The value can also be a placeholder, (?) , in which case, the user will be prompted to enter the Process Item Type name and ID .

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:

C:\gitdemo\Sample> git push -o “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 push -o "cr=Sample:Sample/11.0 Release/5561" -o complete (c)

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 push

The process item specified in the Git commit message would automatically be used to be linked while pushing the changes to StarTeam view.

Miscellaneous push options

Attach to Label during push

Specify a StarTeam Label to be applied to the pushed commits. 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.

C:\gitdemo\Sample> git push -o attach-label=16.0.2.6 

where '16.0.2.6' is a view/revision label name

Locks

Obtain a StarTeam lock on files/folders while pushing to StarTeam Server.

C:\gitdemo\Sample> git push -o lock

non-exclusive-lock (x)

Obtain a non-exclusive lock on StarTeam Files/Folders being pushed. C:\gitdemo\Sample> git push -o non-exclusive-lock

unlock Unlock Files/Folders after pushing to StarTeam Server.

C:\gitdemo\Sample> git push -o unlock

Note: Cross-branch pushes like shown in the example below are not supported in the StarTeam Git Client.

git push origin test:master (where test is the name of a local branch)

git push/pull to/from a view deeper in the hierarchy should work.

When a newly created branch is pushed to StarTeam, a new view is created on the StarTeam server based on the parent view from which the branch was created in the GIT repository.