Introduction to GitHub – What Is GitHub and Why Do Developers Use It?
GitHub is an online platform that hosts Git repositories and helps developers collaborate on software projects.
- Understand Git and GitHub and their differences.
- Learn how repositories store and organize projects.
- Understand commits, branches and pull requests.
- Learn how developers upload code to GitHub.
- Understand how professional development teams use GitHub.
1. Why Do Developers Need GitHub?
Imagine you are developing a banking application with five other developers. One developer works on customer registration, another works on loan processing, and another develops payment functionality.
Everyone is working on the same application. But how do you combine everyone's code without accidentally overwriting someone else's work?
What happens if a developer introduces a bug? How can you identify which changes caused it? How can you restore an earlier working version?
Sharing ZIP files or copying code between developers is not a reliable solution.
This is where Git and GitHub become important.
Git tracks changes in your source code. GitHub provides an online platform where Git repositories can be stored, shared, reviewed and managed collaboratively.
Today, development teams use GitHub for application development, code reviews, issue tracking, project management and automation.
Git tracks your code changes. GitHub helps you host those repositories and collaborate with other developers.
2. Understand Git Through Daily Life
Consider a college project where five students are preparing a final project report.
Initially, everyone works on different sections. One student prepares the introduction, another works on the diagrams, and another prepares the technical implementation.
They need a common place to maintain the latest report and review each other's contributions.
Git and GitHub provide a similar workflow for software development.
| College Project | Software Development |
|---|---|
| Project report | Source code repository |
| Save a new version | Git commit |
| Work on a separate chapter | Git branch |
| Submit work for review | Pull request |
| Combine approved chapters | Merge changes |
| Shared project folder | GitHub repository |
Instead of sending files repeatedly, developers use Git to track their work and GitHub to share it with the team.
3. What Exactly Is Git?
Version control means maintaining a history of changes made to files over time.
Git allows developers to save versions of their code, compare changes, work independently and restore earlier versions when necessary.
Version Control
Suppose you are developing a customer management application.
- Version 1: Created customer registration.
- Version 2: Added customer address.
- Version 3: Added customer search.
- Version 4: Fixed a registration validation bug.
Git maintains the history of these changes through commits. Developers can inspect earlier commits and understand how the application evolved.
Distributed Version Control
Git is distributed because every developer can maintain a complete local repository, including its commit history.
You do not need a permanent internet connection to create commits or inspect your local history. You can synchronize your work with a remote repository later.
Git is a tool that runs on your computer. GitHub is an online service that can host your Git repositories. They are related, but they are not the same product.
4. What Exactly Is GitHub?
Developers can upload their repositories, manage contributions, review code and automate development workflows.
GitHub provides several important features.
Repositories
A repository, commonly called a repo, is a location where a project's files and Git history are maintained.
For example, a banking application might have separate repositories for its customer portal, payment service and loan management system.
Commits
A commit represents a saved snapshot of changes in a Git repository.
Developers usually create commits with meaningful messages describing their work.
Example: Add customer registration validation.
Branches
A branch allows developers to work on a separate line of development without directly changing the main branch.
For example, a developer can create a feature branch to implement loan eligibility calculations.
Pull Requests
A pull request allows developers to propose changes and request that teammates review them before merging into another branch.
Reviewers can inspect code, add comments, request modifications and approve the proposed changes.
Issues
Issues help teams track bugs, enhancements, technical tasks and other project discussions.
GitHub Actions
GitHub Actions helps automate workflows such as building applications, running automated tests and deploying software.
5. Git Versus GitHub
This is one of the most important differences to understand before working with GitHub.
| Git | GitHub |
|---|---|
| Version control system | Repository hosting platform |
| Installed locally | Accessed online or through supported clients |
| Tracks code changes | Hosts Git repositories |
| Supports local commits | Provides pull requests and code reviews |
| Works offline for local operations | Online services require network access |
| Open-source software | Platform operated by GitHub |
In short: Git manages version history. GitHub makes it easier to share and collaborate on Git repositories.
6. How GitHub Works Internally
Let's understand how a developer's changes travel from a local computer to a shared GitHub repository.
The developer commits changes locally, pushes them to GitHub, and proposes them through a pull request for team review.
Step 1 – Write Code Locally
The developer creates or modifies application files on their computer.
Step 2 – Save Changes Using Git
The developer stages the required changes and creates a commit with a meaningful message.
Step 3 – Push to GitHub
The developer sends local commits to the remote GitHub repository using git push.
Step 4 – Create a Pull Request
The developer proposes merging the feature branch into the main branch.
Step 5 – Review and Merge
Team members review the changes. After the required approvals and checks, the changes can be merged.
7. Let's Create Your First Repository
Now let's perform a small practical exercise.
We will create a simple employee management project and upload it to GitHub.
Prerequisites
- A computer running Windows, Linux or macOS.
- A Git installation.
- A GitHub account.
- Internet connectivity for repository synchronization.
- A terminal or command prompt.
Install Git
Download Git from the official website:
After installation, verify that Git is available.
Example 1: Verify Git Installation
git --version
Expected output
git version 2.x.x
The exact version depends on your installed Git release.
Create a GitHub Account
Visit the official website and create an account if you do not already have one.
Create a Remote Repository
- Sign in to GitHub.
- Click the New repository option.
- Enter the repository name as
employee-management. - Choose Public or Private visibility.
- For this exercise, leave README initialization, license and .gitignore options unchecked.
- Click Create repository.
We will create the initial commit locally. Starting with an empty remote repository avoids an unrelated initial-history merge during this exercise.
8. Upload Your First Project
Open your terminal and execute the following commands one by one.
Example 2: Create and Upload the Project
# Create the project folder
mkdir employee-management
cd employee-management
# Initialize a Git repository
git init -b main
# Configure your commit identity
git config user.name "Your Name"
git config user.email "your-email@example.com"
# Create a project file
echo "# Employee Management" > README.md
# Stage and commit changes
git add README.md
git commit -m "Initial employee management project"
# Connect the GitHub repository
git remote add origin https://github.com/yourname/employee-management.git
# Upload the main branch
git push -u origin main
Replace yourname with your actual GitHub username and use the email associated with your Git configuration.
Understand the Important Commands
GitHub does not support normal account-password authentication for Git operations over HTTPS. Use Git Credential Manager or an appropriately configured personal access token. SSH authentication is another option.
9. Verify Your First Upload
After the push succeeds, open your GitHub repository in the browser.
You should see the README.md file and the initial project commit.
To verify the local repository, execute:
Example 3: Check Repository Status
git status
git remote -v
Expected output – clean repository
On branch main nothing to commit, working tree clean origin https://github.com/yourname/employee-management.git (fetch) origin https://github.com/yourname/employee-management.git (push)
The remote URL shown here is the example URL. Your actual output will contain your configured repository URL.
You have created a local Git repository, committed a file and uploaded the project to GitHub.
10. Important GitHub Features
GitHub Pull Requests
Pull requests are used to propose changes from one branch into another.
For example, suppose a developer creates a new feature branch called feature/employee-search.
After implementing the feature and pushing the branch, the developer can create a pull request to merge it into main.
Reviewers can examine the changed files, add comments, suggest modifications and approve the changes.
GitHub Issues
Issues are used to track project work and discussions.
Example issues in an employee management application:
- Employee registration is failing for duplicate email addresses.
- Add employee search functionality.
- Improve employee API response performance.
- Implement role-based authorization.
GitHub Actions
GitHub Actions supports automation through workflow files stored in a repository.
A development team can configure automated workflows to:
- Build a .NET application after a push.
- Execute unit tests when a pull request is created.
- Run code quality checks.
- Deploy an application after an approved merge.
GitHub Projects
GitHub Projects provides planning and tracking capabilities for development teams.
Teams can organize issues and pull requests into views such as Backlog, In Progress and Completed.
GitHub Pages
GitHub Pages allows developers to publish static websites directly from a GitHub repository.
It is useful for documentation, portfolios, technical tutorials and project websites.
11. How Professional Teams Use GitHub
In an enterprise application, multiple developers usually work on different features simultaneously.
Consider a healthcare application with the following development team:
- Developer A – Patient registration.
- Developer B – Appointment management.
- Developer C – Billing integration.
- Developer D – Authentication and authorization.
- Tech Lead – Code review and architecture decisions.
A typical team workflow looks like this:
- The team maintains the source code in a shared GitHub repository.
- Each developer creates a feature branch.
- Developers implement and test their changes locally.
- They commit and push their changes.
- They create pull requests for code review.
- Automated workflows execute builds and tests.
- Approved changes are merged into the target branch.
- The deployment pipeline releases the application according to the team's process.
This workflow improves collaboration, traceability, code quality and release management.
12. GitHub Best Practices
- Use meaningful commit messages: Explain what changed and why.
- Create feature branches: Avoid directly implementing every feature on main.
- Review pull requests: Examine code before merging.
- Protect important branches: Configure branch protection and required checks where appropriate.
- Use .gitignore: Prevent generated files, local configuration and unwanted files from entering version control.
- Never commit secrets: Keep passwords, API keys, access tokens and private certificates out of repositories.
- Keep commits focused: Avoid combining unrelated changes in a single commit.
- Automate quality checks: Run tests and builds through CI workflows.
Never upload application passwords, database connection secrets, private keys or production credentials to GitHub. A private repository is not a secure secrets vault.
13. Public and Private Repositories
When creating a GitHub repository, you can choose its visibility.
| Public Repository | Private Repository |
|---|---|
| Visible to everyone. | Access is restricted to authorized users. |
| Useful for open-source projects. | Useful for internal projects. |
| Anyone can inspect its public source code. | Only permitted collaborators can access it. |
| Contributions can be proposed through pull requests. | Collaboration is controlled through repository permissions. |
Choosing a private repository does not automatically protect accidentally committed credentials. Always follow proper secrets management practices.
14. Common GitHub Mistakes
Confusing Git with GitHub
Git is the version control system. GitHub is a platform that hosts Git repositories and provides collaboration services.
Forgetting to Commit Changes
Uploading a repository does not automatically save every local modification. Stage and commit the changes before pushing them.
Working Directly on Main
For collaborative development, feature branches and pull requests provide a safer and more reviewable workflow.
Uploading Sensitive Files
Use .gitignore and secure secrets management. If a secret is accidentally exposed, revoke or rotate it immediately. Removing it from the latest commit alone does not guarantee that it is gone from repository history or other copies.
Not Pulling Remote Changes
Before starting work, synchronize with the appropriate remote branch to reduce avoidable conflicts.
15. Interview Questions and Answers
GitHub is a cloud-based platform for hosting Git repositories and supporting software development collaboration through pull requests, issues, code reviews and automation.
Git is a distributed version control system that tracks source code changes. GitHub is an online platform that hosts Git repositories and provides collaboration features.
A Git repository is a project directory tracked by Git, including its files and version history.
Branches allow developers to work on independent features or fixes without directly changing the main development branch. This supports parallel development and controlled integration.
A pull request is a proposal to merge changes from one branch into another. It allows developers to review, discuss and validate changes before integration.
GitHub Actions automates software development workflows, including building applications, running tests and deploying code.
Yes. Git can track changes, create commits, create branches and maintain local history without GitHub. GitHub is an optional remote hosting and collaboration platform.
A local repository is maintained on your computer. A remote repository is hosted elsewhere, such as on GitHub, and can be synchronized with local repositories.
16. Hands-On Practice
Try these exercises to strengthen your understanding.
Exercise 1 – Create a Repository
- Create a GitHub account.
- Create a repository named
my-first-project. - Initialize a local Git repository.
- Create a README.md file and commit it.
Exercise 2 – Update Your Repository
- Add a project description to README.md.
- Create a new commit.
- Push the changes to GitHub.
- Verify the latest commit on GitHub.
Exercise 3 – Explore Collaboration
- Create a feature branch.
- Modify a project file.
- Push the branch to GitHub.
- Create a pull request.
- Review and merge the changes.
17. What Should You Learn Next?
Now you understand what GitHub is, why developers use it and how to upload your first project.
However, professional development requires more than uploading code. You should understand repositories, branches, commits, remote operations and collaboration workflows in detail.
Continue learning through this Git and GitHub series:
- GitHub Account Setup
- Git Installation and Configuration
- GitHub Repositories
- Git Fundamentals
- Git Commands
- Git Commits
- Git Branching
- Git Merge
- Git Remote Operations
- GitHub Pull Requests
Git tracks changes. GitHub hosts repositories and enables collaboration. Together, they form an essential part of modern software development workflows.
Upgradix by Shrash Studio
Learn Technology. Build Your Future.
Quality Technology Education. Completely Free.
18. Official Learning Resources
- Git Official Documentation
- GitHub Official Documentation
- GitHub Getting Started Guide
- GitHub Pull Requests Documentation
- GitHub Actions Documentation
Upgradix by Shrash Studio – Learn Technology. Build Your Future.