0% found this document useful (0 votes)
9 views2 pages

Git & GitHub: Version Control Basics

This module teaches students about Git and GitHub, focusing on version control, basic Git operations, and collaboration techniques. Students will learn to create and manage repositories, handle branches, and resolve conflicts, culminating in a hands-on mini project. The module also includes installation instructions and teaching tips for effective learning.

Uploaded by

mshree0327
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Git & GitHub: Version Control Basics

This module teaches students about Git and GitHub, focusing on version control, basic Git operations, and collaboration techniques. Students will learn to create and manage repositories, handle branches, and resolve conflicts, culminating in a hands-on mini project. The module also includes installation instructions and teaching tips for effective learning.

Uploaded by

mshree0327
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 2: Version Control with Git & GitHub

Learning Objectives
By the end of this module, students should be able to: - Understand what Git is and why version
control is important. - Perform basic Git operations (init, clone, add, commit, push, pull). - Work with
branches and resolve merge conflicts. - Collaborate using GitHub (forks, pull requests, and issues).
- Create and manage a small collaborative project on GitHub.

1. Introduction to Git (What & Why)


Git is a distributed version control system that helps developers: - Track changes in source code
over time. - Work collaboratively without overwriting each other’s work. - Revert back to previous
versions if something goes wrong. Why use Git? | Problem | Solution | |----------|-----------| |
Overwriting code | Branching | | Losing versions | Commit history | | Can’t revert | Rollback commits
| | Hard to share | Remote repositories | Git vs GitHub Git is the local version control tool, while
GitHub is the online platform for hosting and collaborating on Git repositories.

2. Git Basics
Commands: - git init → Create new repository. - git clone → Copy existing repo from GitHub. - git
add → Stage files for commit. - git commit → Save version with message. - git push → Upload
changes to GitHub. - git pull → Download updates from GitHub.

3. Branching, Merging, and Resolving Conflicts


Branches allow independent work without affecting the main code. - Create branch: git branch
feature-login - Switch branch: git checkout feature-login - Merge: git merge feature-login - Resolve
conflicts by editing the file and committing again.

4. Using GitHub for Collaboration


- Fork: Copy someone else’s repository to your account. - Pull Request: Suggest changes to the
original project. - Issues: Report bugs or request features. - Add Collaborators: Go to Settings →
Collaborators → Add people → Enter GitHub username → Add → Collaborator accepts invite.

5. Hands-on: Mini Project


Objective: Create a GitHub repository and collaborate. Steps: 1. One student creates a repo and
adds collaborators. 2. Each collaborator clones it using git clone. 3. Create branch for your feature.
4. Commit and push changes. 5. Open Pull Request and merge.

6. Setting Up Git and GitHub


Installation: 1. Download Git from [Link] 2. Install with default settings. 3.
Verify with git --version. Configure: git config --global [Link] "Your Name" git config --global
[Link] "your_email@[Link]" Create GitHub Account: 1. Go to [Link] → Sign
up → Verify email. 2. Create repository → Add README → Create. Connect Git and GitHub: git
remote add origin [Link] git push -u origin main

7. Summary
| Step | Description | |------|--------------| | git init | Start local repo | | git add . | Stage files | | git commit
-m "msg" | Save version | | git push | Upload changes | | git pull | Download updates | | git branch |
Create new branch | | git merge | Merge branches | | Fork & PR | Collaborate on GitHub |

8. Teaching Tips
- Demonstrate installation and basic commands live. - Ask students to push their first repo to
GitHub. - Encourage team collaboration using branches. - Use simple visual diagrams for version
control concepts.

You might also like