In this blog, I share how working with friends on GitHub made learning more engaging, practical, and enjoyable.
Note → Here I’ll explain the topic by taking an example of the two guys who want to work on the same project
First of all we have to decide who will be the main member of the team , as we are the team of two members A and B , So let say A is the main guy of the team so these are the initial steps that member A have to take
Initialize the project in VS code (any editor) and ensure all the connections and initial files are properly created.

As you can see over here the initial files has been created by the member A
Now he need to create the repo in the github and then push this code to the repository directly in the main branch

As you can see the Member A have pushed the code into the github
Now he need to add the collaborators settings → collaboratos → Manage Access → Add people then you need to search the name of the contibutor by username,email or full name and send the invite request

After this the Memeber B need to accept the invitation from his/her mail

Accept the invitation from here. and Bang! you are able to see the same repository on your device as well no matter weather it is the private/public as a contributor it is visible to you
First of all he has to clone the repository git clone Link_of_repo

here you can see the Member B have cloned the repository GITHUBCOLLAB
Now here comes the most important Step. Member B is not suppose to right a single line of code before creating his branch , means he need to create his branch first then make changes in that branch . The command for this is git switch -C feature/01 here the branch name is feature/01

You can see the commands inside the terminal , i have created a branch and i switch to that branch..
Now Memeber 2 , can make changes in the code base for example i am going to make some changes inside the index.html file

Here i have created a profile card and added some lines on the readme.md as well
Now i need to commit the changes and push the code to the github
git add . → git commit -m “added card“ → git push -u origin feature/01

Now the Member B is suppose to inform the Member A that i have done my work and pushed the code in the github now it’s your turn to review it and merge it .
Go to the dashboard of the github repository and you will able to see the pull request and the name of the branch created by the member B (collaborator)

first of all he need to run git fetch

althrough here it is not showing the branch name after fetching but you can see the branch name from the dashboard and then switch to that branch And now the member A is also able to see the changes made by the collaborator in his device

Here you can see the card that is created by the Member B is now visible in the device of the main guy.
And now run git switch main → git merge feature/01

And finally push the code to the github git push origin main and after pushing the code Member A will able to see this

one last step for the contributor is that after his pull request get merged he need to pull those changes by runnig git pull

similarly if the main guy make any changes then he need to inform the other member and other member need to pull the changes and start working on it.
So , Hope you have learned something , then main motive behind writing this blog is I have seen many people (specially beginners) are struggling a lot while collaborating and also there is one thing some people are talking about the code conflict → so my advice is if you go through this blog throughly then hardly you will face any conflct , if there then it can be easily resolvable
Thank you . Make sure to hit the like button if you got any information from this blog and also leave a comment (feedback or anything) ⭐
2
8
0