0% found this document useful (0 votes)
3 views1 page

git_github_lab_program

The Git & GitHub Lab Program aims to teach participants the fundamentals of version control with Git and collaboration through GitHub. It includes tasks such as configuring Git, creating and committing files, connecting local repositories to GitHub, and managing branches. The expected outcome is for students to successfully initialize a local Git repository, commit changes, and perform push and merge operations on GitHub.

Uploaded by

ekta
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)
3 views1 page

git_github_lab_program

The Git & GitHub Lab Program aims to teach participants the fundamentals of version control with Git and collaboration through GitHub. It includes tasks such as configuring Git, creating and committing files, connecting local repositories to GitHub, and managing branches. The expected outcome is for students to successfully initialize a local Git repository, commit changes, and perform push and merge operations on GitHub.

Uploaded by

ekta
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
You are on page 1/ 1

Git & GitHub Lab Program

1. Objective
To learn the basics of version control using Git and collaboration using GitHub.
2. Prerequisites
• Git installed on your system (https://git-scm.com/downloads)
• A GitHub account (https://github.com/)
• Basic knowledge of command line (Terminal / Git Bash)
3. Lab Tasks
Task 1: Configure Git
git config --global user.name "Your Name" git config --global user.email
"[email protected]" git config --list Explanation: This sets your name and email for all
commits.

Task 2: Create a Local Repository


mkdir my-first-repo cd my-first-repo git init Explanation: • mkdir → Creates a folder • cd → Enters
the folder • git init → Makes it a Git repository

Task 3: Create and Commit a File


echo "Hello Git" > file1.txt git status git add file1.txt git commit -m "First commit - Added file1.txt"
Explanation: • git status → Shows changes • git add → Stages file • git commit → Saves it in Git
history

Task 4: Create a GitHub Repository


1. Log in to GitHub 2. Click New Repository 3. Name it my-first-repo 4. Keep it public and empty
(don’t add README) 5. Copy repository HTTPS URL

Task 5: Connect Local Repo to GitHub


git remote add origin https://github.com/username/my-first-repo.git git branch -M main git push -u
origin main Explanation: Links local repo to GitHub and pushes code online.

Task 6: Make a Change and Push


echo "Second line" >> file1.txt git add file1.txt git commit -m "Updated file1.txt" git push Explanation:
• >> appends text • Push changes to GitHub

Task 7: Clone a Repository


cd .. git clone https://github.com/username/my-first-repo.git Explanation: Creates a local copy of
any GitHub repo.

Task 8: Branching and Merging


git checkout -b new-feature echo "Feature added" > feature.txt git add feature.txt git commit -m
"Added new feature" git checkout main git merge new-feature git push Explanation: • Create a
branch for new work • Merge into main after completion

4. Expected Output
• Local Git repository initialized
• Changes committed and pushed to GitHub
• Students able to pull, push, and merge code

You might also like