GitHub is a necessary tool when you cooperate with other people on a project. This post will introduce how to use GitHub and configure the git repository in STS/Eclipse. STS and Eclipse are very similar to each other so I will demonstrate STS.
This is how Git works and soon, we will be more familiar with the local repository and remote repository.
First, you need to have your account in GitHub. As I already have one, I will sign in on GitHub.
Click the settings.
Go to Developer settings and create Tokens(Classic). We will use these tokens when we connect our repository to the local in STS / Eclipse.
To clone the repository, copy the HTTPS for pasting in STS / Eclipse.
In a show view, make Git Repository visible and clone the git repository source by pasting the HTTPS and the tokens in the location and Authentication. The user is the email ID that you use to log in to GitHub.
After the creation, you will see this Git Repositories tap.
Right Click the Working Tree folder. By clicking Import Projects you can import the remote repository to the local.
To connect, right-click the project and go to Team - Share Project.
After connecting it, you will see the new options when you go to Team. Among them, click Commit.
You can upload the edited files in the Git Staging that will pop up. The repository has something changed to re-upload and Commit Message to attach.
There are two buttons, Commit and push for uploading to the local and the remote repository, whereas, Commit is only for the local repository.
To see the updated repository on GitHub, click Commit and Push.
After clicking Next and Finish buttons, you will see this on your GitHub.
Now, let us try creating a new branch in STS. In the group project, each group member needs to create their branch and work in the branch.
Right click - Team - Switch To - New Branch
Write the new branch name.
So, when you do the project with your colleagues, you will see a lot of this alert on GitHub.
About the button Compare & pull request, there is a tap on Github. To merge the branches, click New pull request.
Choose the base and compare and click Create pull request.
Again, after writing some comments, click Create pull request.
After checking if there is any conflicts with the base branch, you can Merge pull request.