Skip to the content.

GitHub Reference Guide

Back

What is a Repository?

You can think of a repository as a folder that contains related items, such as files, images, videos, or even other folders. A repository usually groups together items that belong to the same “project” or thing you’re working on.

Often, repositories include a README file, a file with information about your project. README files are written in Markdown, which is an easy-to-read, easy-to-write language for formatting plain text.

About Branching

Branching lets you have different versions of a repository at one time.

By default, your repository has one branch named main that is considered to be the definitive branch. You can create additional branches off of main in your repository.

Branching is helpful when you want to add new features to a project without changing the main source of code. The work done on different branches will not show up on the main branch until you merge it, which we will cover later in this guide. You can use branches to experiment and make edits before committing them to main.

When you create a branch off the main branch, you’re making a copy, or snapshot, of main as it was at that point in time. If someone else made changes to the main branch while you were working on your branch, you could pull in those updates.

This diagram shows:

📖 Learning Resources

🚀 Getting Started with GitHub

This section explains the core ideas behind accounts and repositories on GitHub. If you need terminal commands, see the Git guide in this course.

Creating Your GitHub Account

  1. Go to github.com
  2. Click “Sign up”
  3. Choose a username (this will be part of your profile URL)
  4. Use your college email address. (Normally your personal email ID is preferred but you can get Github Education pack for free if you use your College email address)
  5. Verify your account

Your First Repository

Method 1: Create on GitHub First

  1. Click the “+” icon → “New repository”
  2. Name your repository
  3. Add a description
  4. Choose Public or Private
  5. Initialize with README
  6. Click “Create repository”

Method 2: Push Existing Local Project

# In your project folder
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/username/repo-name.git
git push -u origin main

📁 Repository Management

Cloning Repositories

# Clone a repository
git clone https://github.com/username/repository-name.git

# Clone to specific folder
git clone https://github.com/username/repo.git my-folder

Repository Settings

🤝 Collaboration Features

Issues

Track bugs, feature requests, and tasks:

  1. Creating Issues
    • Click “Issues” tab → “New issue”
    • Use descriptive titles
    • Add labels (bug, enhancement, question)
    • Assign to team members
    • Reference in commits: git commit -m "Fix login bug, closes #15"
  2. Issue Templates
    • Bug reports
    • Feature requests
    • Questions

Pull Requests (PRs)

Propose changes to a repository:

Creating a Pull Request

  1. Create a branch: git checkout -b feature-name
  2. Make changes and commit
  3. Push branch: git push -u origin feature-name
  4. Go to GitHub → “Compare & pull request”
  5. Add title and description
  6. Request reviewers
  7. Submit pull request

Pull Request Best Practices

Forking

Copy someone else’s repository to your account:

  1. Click “Fork” button on any repository
  2. Clone your fork: git clone https://github.com/YOUR-USERNAME/REPO-NAME.git
  3. Add upstream remote: git remote add upstream https://github.com/ORIGINAL-OWNER/REPO-NAME.git
  4. Keep your fork updated:
    git fetch upstream
    git checkout main
    git merge upstream/main
    git push origin main
    

👥 Team Collaboration

Adding Collaborators

  1. Go to repository Settings
  2. Click “Manage access”
  3. Click “Invite a collaborator”
  4. Enter username or email
  5. Choose permission level

Branch Protection Rules

Protect your main branch:

  1. Settings → Branches
  2. Add rule for main
  3. Enable:
    • Require pull request reviews
    • Require status checks
    • Restrict pushes to main

Team Workflow

# 1. Get latest changes
git pull origin main

# 2. Create feature branch
git checkout -b feature/new-feature

# 3. Work and commit
git add .
git commit -m "Add new feature"

# 4. Push and create PR
git push -u origin feature/new-feature
# Then create PR on GitHub

# 5. After PR is merged, clean up
git checkout main
git pull origin main
git branch -d feature/new-feature

📊 GitHub Features for Projects

GitHub Pages

Host websites directly from your repository:

  1. Setup
    • Go to Settings → Pages
    • Choose source: Deploy from branch
    • Select main branch
    • Your site: https://username.github.io/repository-name
  2. Jekyll Sites (like this course!)
    • Add _config.yml with theme
    • Use markdown files
    • Automatic building and deployment

GitHub Actions (CI/CD)

Automate workflows:

Basic workflow file (.github/workflows/test.yml):

name: Run Tests
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Run tests
      run: npm test

Project Boards

Organize work with Kanban boards:

  1. Go to “Projects” tab
  2. Create new project
  3. Add columns (To Do, In Progress, Done)
  4. Add cards from issues and PRs
  5. Track progress visually

🔍 Exploring GitHub

Discovering Projects

Following and Starring

Your GitHub Profile

Make a great first impression:

  1. Profile README
    • Create repository named your username
    • Add README.md to showcase yourself
    • Include your skills, projects, contact info
  2. Contribution Graph
    • Shows your daily activity
    • Green squares = commits
    • Consistency matters more than intensity

📋 GitHub Commands Cheat Sheet

Action Command/Location
Clone repository git clone <url>
Create issue Issues tab → New issue
Create PR Compare & pull request
Fork repository Fork button
Add collaborator Settings → Manage access
Enable Pages Settings → Pages
Create release Releases → Create new release

🎯 Practice Exercises

Exercise 1: Your First Repository

  1. Create a new repository on GitHub
  2. Clone it locally
  3. Add a README.md with your project description
  4. Commit and push changes
  5. Edit README on GitHub web interface
  6. Pull changes to local repository

Exercise 2: Collaboration Practice

  1. Fork a public repository
  2. Clone your fork
  3. Create a new branch
  4. Make a small improvement (fix typo, add comment)
  5. Push branch and create pull request
  6. Practice the full contribution workflow

Exercise 3: Issues and Project Management

  1. Create issues for features you want to add
  2. Use labels to categorize issues
  3. Create a project board
  4. Move issues through workflow stages
  5. Close issues with commit messages

🆘 Common GitHub Issues

“Permission denied (publickey)”

“Repository not found”

“Merge conflicts in pull request”

“Can’t push to main branch”

💡 GitHub Best Practices

Repository Organization

Commit Practices

Security

Community Guidelines


Previous: Git Guide Back to: Course Home