DEV Community

Cover image for GitHub Collaboration Guide: Contribute Without Forking
Godfrey Nyarko
Godfrey Nyarko

Posted on

GitHub Collaboration Guide: Contribute Without Forking

Introduction:

Contributing to a GitHub repository without forking is a great way to streamline collaboration and keep your GitHub profile tidy. This guide will walk you through the process of adding a collaborator, contributing as a collaborator, and using branches for more efficient contributions.

Adding a Collaborator as an Author:

  1. Open the repository to which you want to add a collaborator. For example, let's say you want to add a collaborator to the "author_username/zero_day" repository.
  2. Click on "Settings." A screenshot image of "Settings tab" in GitHub GUI
  3. Navigate to "Collaborators." A screenshot image of "Collaborators tab" in GitHub GUI
  4. Click on Use GitHub Mobile to confirm access. A screenshot of Confirmation process in GitHub
  5. Select "Add people." A screenshot image of "Add people tab" in GitHub GUI
  6. Enter the collaborator's username or full name. A screenshot image of where to enter collaborator's user name
  7. Click on Select a Collaborator above.

An invitation email will be sent to the collaborator.

Contributing as a Collaborator:

Once the author has added you as a collaborator, you will receive an invitation email from GitHub.

  1. Accept the invitation email. Simply click on the provided link to accept the collaboration invitation.

  2. Open your GitHub account interface. After accepting, you will see the "author_username/zero_day" among your existing repositories.

  3. Open your terminal.

  4. Clone the new repository using the Git clone command. For instance:

    git clone https://{your_personal_token}@github.com/{author_username/zero_day}.git
    
  5. Use "git pull" to retrieve all the updated files. This ensures you have the latest changes from the repository.

    git pull
    

Working on a Different Branch:

As a collaborator, it's advisable to work on a separate branch to avoid conflicts when pushing your code.

  1. Create a new branch. Let's call it "Collabo-branch" as an example:

    git branch Collabo-branch
    
  2. Switch to the new branch you created, so your works and changes are isolated:

    git checkout Collabo-branch
    
  3. After reviewing and completing your task on the new branch, you can merge it back into the main branch. For example:

git checkout main
git merge Collabo-branch
Enter fullscreen mode Exit fullscreen mode

Always remember to "git pull" after changing to the main branch before you merge.

By following these steps, you can effectively collaborate on a GitHub repository without forking, thereby making the contribution process more efficient.

Let me know the challenges you encounter in the comment box, and I will put forth my utmost effort to address them

Top comments (0)