Branches in a Git Repository
Last modified by Microchip on 2024/06/24 06:35
Creating a Branch
Follow the steps below to create a branch in Git.
In the Projects window, choose a project from the repository in which you want to create the branch.
In the main menu, choose:
Team > Branch/Tag > Create Branch...
Team > Branch/Tag > Create Branch...
Enter the name of the branch being created.
Type a specific revision of the selected item or use the Select button.
Review the Commit ID, Author, and Message fields for information specific to the revision being branched from.
Click Create.
Checking Out Sources from a Branch
To edit files on a branch that already exists, you can check out the branch to copy the files to your Working Tree.
In the Projects Window, choose a project.
From the Main menu choose:
Team > Checkout > Checkout Revision...
Specify the required revision or use the Select button
Review the Commit ID, Author, and Message fields information specific to the revision being branched from
To create a new branch out of the checked-out revision, choose the Checkout as New Branch option and enter the Name in the Branch Name field.
Click Checkout
Merging Branches
To port modifications from a repository revision to the Working Tree:
In the Projects window, choose a project.
From the main menu choose:
Team > Branch/Tag > Merge Revision
Team > Branch/Tag > Merge Revision
Specify the required revision or use the Select button.
Review the Commit ID, Author, and Message fields for information specific to the revision being branched from.
Click Merge.
Deleting a Branch
To delete an unnecessary local branch, complete the following steps:
In the Project window, choose a project.
From the main menu choose:
Team > Repository > Repository Browser
From the main menu choose:
Team > Repository > Repository Browser
In the Git Repository Browser, choose the branch to be deleted.
Right-click the selected branch and choose Delete Branch from the popup menu.
In the Delete Branch dialog box, press OK to Confirm the branch deletion.