• iconteach@devfunda.com

Collaboration in Git

Collaboration in Git

28-08-2025 15:44:28 Time to read : 12 Minutes

Collaboration in Git means working together with other developers on the same project using Git and a remote repository (like GitHub, GitLab, or Bitbucket).

Instead of everyone editing the same file and overwriting each other’s work, Git provides a system where:

  • Each developer can work on their own copy of the project.
  • Changes are tracked and can be merged back together safely.
  • The history of all contributions is stored, so nothing is lost.

Collaboration with Forks

  1. Fork - A fork is simply a copy of someone else’s repository under your own GitHub account.
    1. You get your own independent version of the project.
    2. You can make changes freely without affecting the original project.
    3. Later, if you want your changes to be included in the original project, you create a Pull Request (PR).
      For example

      Imagine there’s a popular open-source project (say, a calculator app) on GitHub:

      1. You fork the repository, now you have your own copy.
      2. You add a new feature, like a Dark Mode.
      3. After testing, you send a Pull Request to the original project owner.
      4. If they like your work, they merge your changes into the main project.
    4. How to Fork a Repository

      Step 1: Find the Repository
      Go to GitHub and open the repository you want to contribute to.
      Example: https://github.com/username/project

      Step 2: Click the "Fork" Button
      On the top-right corner of the repository page, you’ll see a “Fork” button.


      Click it.

      GitHub will create a copy of that repository in your account.

      Step 3: Clone Your Fork
      Now, you need the repository on your computer.

      Open Git Bash / Terminal and run:

      git clone https://github.com/your-username/project.git

      This downloads your forked repo locally.

      Step 4: Make Changes
      Open the project folder in your editor (like VS Code).

      Add new features, fix bugs, or improve documentation.

      Step 5: Commit and Push Changes

       

  2. Collaboration with Pull Request
    1. A Pull Request (PR) is a way of telling the project owner: “I’ve made some changes in my fork/branch. Please review them and, if everything looks good, merge them into the main project.”
      Think of it as asking for permission to merge your work into the main repository.
    2. Why Do We Use Pull Requests?
      1. To propose new features or bug fixes.
      2. To let others review your code before merging.
      3. To discuss improvements with team members.
      4. To keep the main branch stable.

Want to learn in class