Local Branching Process (GIT, GITHUB)

Local Branching Process (GIT, GITHUB)

Hi all,

In this article, I am going to explain the local branching process and if you join as a new member in any automation project, which steps you need to follow for local branching

Step 1

  • Your company will provide you with the GitHub repository URL
  • You need to create the directory in your local system on any drive. For example, I have created the folder in the D drive as

No alt text provided for this image

Step 2

  • Now, you need to clone the repository using Git clone command.
  • Use the following command, to clone the code in your local drive.

Git Clone <repository URL>

For example:

Git Clone https://github.com/nancytestdemo/NewProjectDemo

After cloning, it will show like this:

No alt text provided for this image


Step 3

  • After this, you need to import this project into your IDE (Eclipse or IntelliJ), please follow the below steps
  • Open Eclipse, click on the menu "File" and select "Import"

No alt text provided for this image

  • Click on "Maven -> Existing Maven Projects" and click on the button "Next"

No alt text provided for this image

  • Browser the project folder and select the checkbox "pom.xml c:/projectcode" and click on the button "Finish"

Step 4

Now as a new team member, you need to do the local branching as you can't start working on the master branch. Please follow the below steps for local branching

  • Go to your CMD, and run the following command to check which branch you are on currently

Git branch

It will show you the branch name in which you are currently.

  • Now, you need to cut a new branch from the master branch and start working on it. Run the following command to create a new branch

Git branch <branchname>

For example

Git branch Feature

It will create a new branch as "Feature"

  • You need to switch now to the "Feature" branch by using the following command

Git checkout <branchname>

For example

Git checkout Feature

You are now switched to the branch "Feature"

Step 5

You need to ensure that in your IDE, you are working in your "Feature" branch, please follow the below steps to check

  • Right-click on your project, and select "Refresh"
  • Again right-click, and select "Close Project"
  • Then again right click on your project and select "Open Project"
  • Now, you will be able to see the branch name with your project name like this,

No alt text provided for this image

  • You can now start working on this branch and then can add, commit and push the code.


Click here to learn how Git branching strategies play a crucial role in managing code development, collaboration, and version control. bit.ly/3XRWRF3

回复
Swaroop Nadella

Test Automation Engineer | Tech Educator, YouTuber

2 年

Good article on Git branching. Useful to beginners.

Udit Kumar

Sr Technical Lead | USA B1/B2 Visa Holder | SDET | Selenium | Java | Cypress | Playwright | JavaScript | Typescript | API Testing | Automation Testing | Manual Testing |

2 年

Nice Notes

要查看或添加评论,请登录

Nancy B.的更多文章

社区洞察

其他会员也浏览了