viscalyx / Viscalyx.Common

Common commands that adds or improves functionality or workflow in various scenarios.
MIT License
0 stars 1 forks source link

`Rename-GitLocalBranch`: New command proposal #10

Open johlju opened 1 month ago

johlju commented 1 month ago

Command proposal

Command to run:

# Renames local branch master to main
git branch -m master main
git fetch origin
# Set up main to track upstream branch main
git branch -u origin/main main
# Changes default branch be set to main for remote origin
git remote set-head origin --auto

Proposed parameters

Parameter Mandatory Data type Description Default value Allowed values
Name Yes String Specifies the current branch name None -
NewName Yes String Specifies the branch name to rename to None -
RemoteName No String Specifies the remote that has the upstream branch. This is required if any of the two switch parameters are used 'origin' -
SetDefault No Switch Indicates that the new branch name should be set to the default for the remote None -
TrackUpstream No Switch Indicates that the new branch name should be set to the track the branch in he remote None -

Special considerations or limitations

None.