Blog about Web Programming and Electronics
💬 👤
back Back to blog
Programming

How GitHub Works: From Repository to Collaboration

GitHub is a web platform that provides hosting for Git repositories and adds collaboration tools that facilitate team work. Although Git and GitHub are often confused, they are two distinct things - Git is a tool for tracking changes, while GitHub is a web service that puts Git repositories in the cloud.

Git vs. GitHub - What's the Difference?

This is one of the most common confusions among beginners. Simply put: Git is the engine for tracking changes, GitHub is the house where those changes are stored and shared with others.

Feature Git GitHub
Type Local tool Web platform
Installation Install on computer Access via browser
Function Track changes Hosting + collaboration
Alternatives Mercurial, SVN GitLab, Bitbucket
Cost Free (open source) Free + paid plans

Key GitHub Concepts

Before diving into how it works, we need to understand the basic concepts GitHub uses:

  1. Repository: A folder that contains all project files and change history
  2. Fork: A copy of someone else's repository to your account, where you can independently modify code
  3. Pull Request (PR): A proposal to include your changes in someone else's repository
  4. Clone: Downloading a repository from GitHub to your local computer
  5. Issue: Tracking bugs, suggestions, and tasks within a project
  6. README: The main documentation file displayed on the repository page

Collaboration Workflow

A typical workflow on GitHub looks like this:

# 1. Clone the repository to your local machine
git clone https://github.com/username/project.git

# 2. Create a new branch for your feature
git checkout -b new-feature

# 3. Make changes and commit them
git add .
git commit -m "Added new feature"

# 4. Push the branch to GitHub
git push origin new-feature

# 5. Open a Pull Request on GitHub
# 6. Repository owner reviews the code
# 7. After approval, changes are merged into the main code

Fork and Pull Request in Practice

When you want to contribute to a project that isn't yours (e.g., an open-source project), you use the Fork & Pull Request process:

  1. Fork: On GitHub, click "Fork" - this creates a copy of the repository under your account
  2. Clone: Clone your fork to your local computer
  3. Branch: Create a new branch for your changes
  4. Commit & Push: Commit your changes and push them to your fork
  5. Pull Request: Open a PR against the original repository on GitHub
  6. Review: The owner reviews your code and accepts or rejects it

Alternative Platforms

GitHub isn't the only option. Here's an overview of the most well-known alternatives:

Platform Owner Highlight
GitLab GitLab Inc. Built-in CI/CD, self-hosted option available
Bitbucket Atlassian Tight integration with Jira and Confluence
Codeberg Non-profit Open source, data hosted in EU (Germany)

For beginners, GitHub is an excellent choice due to its large community, extensive documentation, and free features. Later, you can switch to GitLab if you need a self-hosted solution or advanced CI/CD.

Given your interests - GitHub Pages is a fantastic feature that enables free hosting of static websites directly from a repository. This is ideal for portfolios, documentation, or smaller projects.

back Back to blog