You have checked out the required branch from git and would
like to switch to a different branch using eclipse.
developer branch in the below example:
Now let’s make some changes to the existing file and add a
file to depict workspace changes.
Now you would like to switch to another branch (developer2
in this example) without losing the changes done in your current workspace.
Select the Git perspective.
Right click on the git repository > Switch To > New Branch
In the “Create a new branch” window, click Select.
Select the branch you would like to switch to from “Remote
Tracking”.
developer2 in the below example.
Check the “Configure upstream for push and pull” checkbox and
select “Merge” from “When pulling” dropdown.
Uncheck the “Check out new branch” checkbox.
Click Finish.
As you can see from the above image, we now have developer2
branch under Local.
All file changes and the new file are still intact and the
branch has been switched to developer2 branch.
Note:
If you are not able to see the branches under “New Branch
> Select”, please follow the below steps.
Go to Git perspective > Clone a Git repository
Enter the URL and credentials
In the “Branch Selection” window, select all the branches.
Click Next.
In the Local Destination selection window, select the
required branch from “Initial branch” dropdown.
Click on Finish.
You will be able to see the selected initial branch under
Local and all other branches under Remote Tracking.
Right Click on Working Tree > Import Projects >
Finish.
This is really an amazing post, thanks for sharing such a valuable information with us.
ReplyDeleteDevOps Training
DevOps Online Training
DevOps Training in Ameerpet