0% found this document useful (0 votes)
54 views79 pages

Unit 3

The document outlines how to discover and contribute to open-source software (OSS) projects, particularly on platforms like GitHub. It provides detailed steps on using GitHub's features such as trending repositories, issues, and labels to find beginner-friendly projects and engage in discussions. Additionally, it includes guidance on creating repositories, managing issues, and organizing contributions effectively.
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)
54 views79 pages

Unit 3

The document outlines how to discover and contribute to open-source software (OSS) projects, particularly on platforms like GitHub. It provides detailed steps on using GitHub's features such as trending repositories, issues, and labels to find beginner-friendly projects and engage in discussions. Additionally, it includes guidance on creating repositories, managing issues, and organizing contributions effectively.
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/ 79

Discovering Relevant Projects

● Open Source Software (OSS) refers to software that is freely available for modification and
distribution.
● Platforms to discover relevant open-source projects:
○ GitHub: Explore trending repositories and search by technology.
○ GitLab & Bitbucket: Other repositories hosting open-source projects.
○ Open Source Initiative (OSI): Lists approved open-source projects.
○ Mozilla Open Source Support (MOSS): Supports various OSS projects.
○ Red Hat, Apache, Linux Foundation: Hosts various open-source projects.
1. GitHub

GitHub is the largest open-source platform, hosting millions of repositories.


How to Discover Projects on GitHub:

● Trending Repositories:
○ Visit GitHub Trending to find the most active repositories.
○ Filter by programming language and timeframe (daily, weekly, monthly).
● Explore Section:
○ Navigate to GitHub Explore to find curated lists and topics.
● Search by Technology:
○ Use https://github.com/search?q=keyword (replace keyword with tech stack like
Python, AI).
○ Example: https://github.com/search?q=Machine+Learning to find ML-related
projects.
● Labels for New Contributors:
○ Use tags like “good first issue”, “help wanted” to find beginner-friendly projects.
How GitHub Trending Works
The Trending page highlights repositories based on:

● Stars: More stars indicate higher popularity.


● Forks: Projects with many forks show active contributions.
● Recent Activity: Updates, commits, and PRs influence ranking.
● Programming Language Filters: Filter trending projects by specific
languages (Python, JavaScript, etc.).
● Timeframe Filters: Choose daily, weekly, or monthly trends.
How to Use GitHub Trending
Step 1: Access Trending Repositories

● Visit https://github.com/trending.
● The default page shows trending repositories across all languages.

Step 2: Apply Filters

● Filter by Timeframe:
○ Daily: Shows repositories gaining traction quickly.
○ Weekly: Highlights consistent growth in the last 7 days.
○ Monthly: Displays repositories with long-term engagement.
● Filter by Language:
○ Select a specific programming language (Python, JavaScript, C++, etc.).
○ Example: Trending Python Projects.

How to Use GitHub Trending
Step 3: Explore Repository Details

● Click on a repository to view:


○ README file: Provides an overview of the project.
○ Issues & Pull Requests: Check if it's beginner-friendly.
○ Stars & Forks: Higher numbers indicate strong community engagement.

Step 4: Identify Good Projects to Contribute

● Look for repositories labeled "good first issue" or "help wanted".


● Read discussions in the Issues and Discussions sections.
● Follow active developers and organizations to track updates.
https://github.com/FreeTubeApp/FreeTube
https://github.com/FreeTubeApp/FreeTube
https://github.com/FreeTubeApp/FreeTube/issues
https://github.com/FreeTubeApp/FreeTube/issues

GitHub's Issues feature is a tool that helps developers and teams track tasks, report bugs, and discuss
project-related topics within a repository. Here's a simple breakdown:

What Are GitHub Issues?

Issues function like discussion threads where collaborators can:

● Report Bugs: Notify others about problems in the project.


● Request Features: Suggest new functionalities or improvements.
● Ask Questions: Seek clarification or assistance.
● Organize Tasks: Break down work into manageable parts.

Each issue can have a title, description, labels, assignees, and comments, facilitating organized and
transparent collaboration.
https://github.com/FreeTubeApp/FreeTube/issues

The FreeTube GitHub Issues page serves as a centralized platform where users and developers
collaborate to enhance the FreeTube application. Here's an overview of its structure and
functionality:

Navigating the Issues Page


● Open and Closed Issues Tabs: At the top, you'll find tabs indicating the number of open and
closed issues. Open issues are active discussions or reports, while closed issues have been
resolved or deemed irrelevant.
● Filter and Search Options: You can filter issues by author, label, projects, milestones, and
assignees. This helps in locating specific issues or categories, such as bugs or feature
requests.
● Sorting: Issues can be sorted based on criteria like newest, oldest, most commented, or
recently updated, allowing users to prioritize or focus on particular discussions.
Labels

Understanding Issue Labels

Labels are tags assigned to issues to categorize and highlight their nature. Common labels
include:

● bug: Indicates a reported problem or malfunction within the application.


● enhancement: Denotes a suggestion for a new feature or improvement to existing
functionality.
● B: content not loading: Specifies issues where content fails to load as expected.
● B: accessibility: Relates to problems affecting user accessibility.

These labels assist in quickly identifying the nature of an issue and facilitate efficient triaging
and resolution.
Example Issues

Here are a few examples of issues from the FreeTube repository:

1. [Bug]: [BAD_HTTP_STATUS: 403] Potential causes: IP block or streaming URL deciphering failed
○ Description: Users encounter a 403 error when attempting to play videos, possibly due to IP blocking
or issues with URL processing.
○ Discussion: The issue includes user reports, potential causes, and suggestions for troubleshooting.
○ Link: Issue #6701
2. [Bug]: Videos don't load, player continuously flickers
○ Description: Reports of videos failing to load, with the player flickering between sizes.
○ Discussion: Includes steps to reproduce the issue, user environment details, and possible fixes.
○ Link: Issue #5456
[Feature Request]: AppImageUpdate support

○ Description: A suggestion to integrate AppImageUpdate for easier application updates on


Linux systems.
○ Discussion: Users and developers discuss the feasibility, benefits, and implementation
strategies for this feature.
○ Link: Issue #6863
Participating in Discussions
Users are encouraged to engage constructively by:

● Reporting New Issues: Providing detailed descriptions, steps to reproduce, and system
information.
● Commenting on Existing Issues: Sharing experiences, potential solutions, or additional
insights related to the issue.
● Following Up: Keeping track of issues you've reported or are interested in to provide additional
information or test potential fixes.

Active participation aids in the timely identification and resolution of problems, contributing to the
overall improvement of FreeTube.
https://github.com/FreeTubeApp/FreeTube/issues/6882
In the FreeTube GitHub repository, labels are used to categorize and manage issues effectively. Let's break down the specific
labels you've mentioned:

1. B: text/string

● Meaning: This label is applied to issues related to textual content within the application. It encompasses problems like
typos, grammatical errors, incorrect messages, or any discrepancies in the displayed text.
● Example: If a user notices a misspelled word in the user interface or an error message that's unclear, an issue would
be labeled with B: text/string.

2. U: reproduced

● Meaning: This label indicates that the reported issue has been successfully replicated by someone other than the
original reporter. Reproducing an issue is a crucial step in the debugging process, as it confirms the existence of the
problem under specified conditions.
● Example: After a user reports a bug, another contributor follows the described steps and encounters the same
problem. They then add the U: reproduced label to signify this confirmation.

3. bug

● Meaning: This is a standard label used across many GitHub repositories to denote an issue that describes an
unintended flaw or problem in the software. Bugs can range from minor glitches to significant errors affecting
functionality.
● Example: An issue reporting that the application crashes when a specific action is performed would be labeled as a
bug.
In the FreeTube GitHub repository, issue #6597, titled "[Bug]: catppuccinMocha: Color contrast for owner
comments is too low," was opened on January 16, 2025, by user artkapl. This issue highlights a problem
with the color contrast in the "catppuccinMocha" theme, specifically noting that comments from content
owners have insufficient contrast, making them difficult to read.

The issue has been labeled with several tags to categorize and manage it effectively:

● bug: Indicates that the issue is a software defect causing unintended behavior.
● good first issue: Suggests that this problem is suitable for newcomers to the project, likely because
it is self-contained and not overly complex.
● B: accessibility: Denotes that the issue pertains to accessibility concerns, focusing on making the
application usable for all individuals, including those with visual impairments.
● U: reproduced: Signifies that the issue has been confirmed by others who have experienced the
same problem, validating its existence.
In the FreeTube GitHub repository, labels are used to categorize and manage issues effectively. The label B:
Visual is likely a custom label created by the repository maintainers to denote issues related to the visual
aspects of the application. Here's a breakdown of its components:

● B: Prefix: In this context, B could stand for "Bug" or "Behavior," indicating that the issue pertains to a
problem or behavior within the application.
● Visual: This specifies that the issue is related to the visual elements of the application, such as the user
interface, layout, design inconsistencies, or graphical glitches.

Combining these, the B: Visual label likely identifies issues that involve visual bugs or unintended visual
behaviors in the application.
Here are few beginner-friendly tasks from the FreeTube project that you can undertake to start
contributing to open-source development:

1. Enhance Video Sharing Functionality


○ Issue: Sharing and Viewing a Video with Custom Start Time and End Time
○ Description: Currently, FreeTube allows users to share videos with a custom start time
but lacks the option to set a custom end time. Implementing this feature would involve
modifying the sharing functionality to include both start and end times, enhancing user
control over shared video segments.
○ Skills Required: Basic understanding of JavaScript and familiarity with video player
controls.
1. Enhance Color Contrast for Better Accessibility
○ Issue: catppuccinMocha: Color contrast for owner comments is too low
○ Description: In the "catppuccinMocha" theme, the color contrast for owner
comments is insufficient, making them hard to read. Addressing this issue
involves adjusting the theme's color palette to ensure adequate contrast,
thereby improving readability and accessibility for all users.
○ Skills Required: Knowledge of CSS and an understanding of web accessibility
standards.
Getting Started with These Tasks:

● Set Up the Development Environment: Fork the FreeTube repository, clone it locally, and set
up the necessary dependencies.
● Engage with the Community: Comment on the issue you're interested in to express your
intent to work on it. This fosters communication and ensures no duplication of efforts.
● Research and Plan: Understand the existing codebase related to the issue. Plan your
approach before coding.
● Implement and Test: Develop the feature or fix, and thoroughly test it to ensure functionality
and compatibility.
● Submit a Pull Request (PR): Once satisfied with your solution, submit a PR for review,
adhering to the project's contribution guidelines.
How to Create an Issue
1. Navigate to the Repository: Go to the main page of the project on GitHub.
2. Access the Issues Tab: Click on the "Issues" tab located near the top of the page.
3. New Issue: Click the "New Issue" button.
4. Fill in Details: Provide a clear title and detailed description.
5. Submit: Click "Submit new issue" to post it.
A Project with Multiple Repositories
Let's say you're building a "Student Management System" which has:

● A frontend (User Interface)


● A backend (Handles database and logic)
● A mobile app for students

GitHub Repositories:

1. student-management-frontend → React/HTML/CSS for UI


2. student-management-backend → Node.js/Python with database (MySQL)
3. student-management-mobile → Flutter/React Native for mobile app

🔹 Why separate repos?

● Each part of the system has different contributors (UI, Backend, Mobile).
● Easier to manage changes and updates independently.
Step-by-Step Guide
🔹 Step 1: Create Separate GitHub Repositories

We will create three repositories:


1⃣ Frontend (student-management-frontend)
2⃣ Backend (student-management-backend)
3⃣ Mobile App (student-management-mobile)

➡ Creating Each Repository

1. Go to GitHub.
2. Click the "+" (plus icon) → Select "New Repository".
3. Enter Repository Name:
○ For frontend: student-management-frontend
○ For backend: student-management-backend
○ For mobile: student-management-mobile
4. Select Public or Private.
5. Click "Initialize this repository with a README" (optional).
6. Click "Create Repository".
7. Repeat these steps for all three repositories.
Step 2: Add Source Code Using GitHub UI

After creating each repository, we will upload the respective source code.

➡ Uploading Frontend Code (React or HTML/CSS)

1. Open the repository student-management-frontend.


2. Click "Add file" → "Upload files".
3. Drag and drop your frontend project files (React, HTML, CSS).
4. Click "Commit changes".

➡ Uploading Backend Code (Node.js + Express)

1. Open the repository student-management-backend.


2. Click "Add file" → "Upload files".
3. Drag and drop your backend project files (index.js, package.json).
4. Click "Commit changes".

➡ Uploading Mobile Code (React Native / Flutter)

1. Open the repository student-management-mobile.


2. Click "Add file" → "Upload files".
3. Drag and drop your mobile project files.
4. Click "Commit changes".
Step 3: Organizing & Managing Repositories

Once all three repositories have the necessary files:

● Update README.md in each repository to explain its purpose.


● Use GitHub Issues to track progress.
● Invite team members by going to Settings → Manage Access.
About issues

● You can create issues in your repository to plan, discuss, and track work.
● Issues are quick to create, flexible, and can be used in many ways.
● Issues can track bug reports, new features and ideas, and anything else you
need to write down or discuss with your team.
● You can also break your work down further by adding sub-issues and easily
browse the full hierarchy of work to be done.

A "GitHub issue" is a feature within a GitHub repository that allows users to


track, discuss, and manage tasks, ideas, bugs, or feedback related to a project,
essentially acting as a centralized to-do list where people can report problems,
request features, and collaborate on solutions within a project.
About issues

can be created in a variety of ways, so you can choose the most


Issues
convenient method for your workflow.

● For example, you can create an issue from a repository


● While adding sub-issues, convert a comment in an issue or pull request.
● Create an issue from a specific line of code, or via a URL query.
● You can also create an issue from your platform of choice: through the
web UI, GitHub Desktop, GitHub CLI, GraphQL and REST APIs, or
GitHub Mobile.
About issues

Prerequisites

● To create an issue, you need a repository.


● You can use an existing repository that you have write access to, or
you can create a new repository.
● The repository must have issues enabled.
About issues
Opening a blank issue

First, create an issue.

There are multiple ways to create an issue;

You can choose the most convenient method for your workflow.

This example will use the GitHub UI.


About issues

Filling in information

Give your issue a descriptive title. The title should convey at a glance what the
issue is about.

Add a description that explains the purpose of the issue, including any details that
might help resolve the issue. For example, if this is a bug report, describe the
steps to reproduce the bug, the expected result, and the actual result.

You can use markdown to add formatting, links, emojis, and more.
About issues
Adding a task list

It can be helpful to break large issues into smaller tasks, or to track


multiple related issues in a single larger issue.

Add a task list to your issue by prefacing list items with [ ].


Reference existing issues by issue number or URL.

You can use plain text to track tasks that don't have a corresponding
issue and convert them to issues later.
Adding a task list
Adding labels

Add a label to categorize your issue.

For example, you might use a bug label and a good first issue label to
indicate that an issue is a bug that a first-time contributor could pick up.

Users can filter issues by label to find all issues that have a specific label.

You can use the default labels, or you can create a new label.
Adding labels
Adding milestones

You can add a milestone to track the issue as part of a date based target.

A milestone will show the progress of the issues as the target date approaches.
Adding milestones

If your "set milestone" option on GitHub appears empty, it means that there
are currently no existing milestones created within that repository; to use
milestones, you need to first create a new milestone by going to the "Issues"
section of your repository and clicking "New Milestone.
Assigning the issue

To communicate responsibility, you can assign the issue to a member of your organization.

Adding milestones

You can add a milestone to track the issue as part of a date based target. A milestone
will show the progress of the issues as the target date approaches.
Adding the issue to a project

You can add the issue to an existing project and populate metadata for the project
Submitting your issue

Click Submit new issue to create your issue.

You can edit any of the above fields after creating the issue.

Your issue has a unique URL that you can share with team members, or reference
in other issues or pull requests
Communicating

After your issue is created, continue the conversation by adding comments to the
issue. You can @mention collaborators or teams to draw their attention to a
comment. To link related issues in the same repository, you can type # followed
by part of the issue title and then clicking the issue that you want to link.
You can use issues for a wide range of purposes. For example:

● Tracking ideas
● Collecting feedback
● Planning tasks
● Reporting bugs
Issue template example

Below we are creating an issue template for reporting a bug


Creating an issue with GitHub CLI

GitHub CLI is an open source tool for using GitHub from your computer's
command line. When you're working from the command line, you can use the
GitHub CLI to save time and avoid switching context.

To create an issue, use the gh issue create subcommand. To skip the


interactive prompts, include the --body and the --title flags.
Creating an issue from a comment

You can open a new issue from a comment in an issue or pull request. When you
open an issue from a comment, the issue contains a snippet showing where the
comment was originally posted.
Creating an issue from code

You can open a new issue from a specific line or lines of code in a file or pull
request. When you open an issue from code, the issue contains a snippet showing
the line or range of code you chose.

You can only open an issue in the same repository where the code is stored.
Creating an issue from code

On GitHub, navigate to the main page of the repository.


Locate the code you want to reference in an issue:
○ To open an issue about code in a file, navigate to the file.
○ To open an issue about code in a pull request, navigate to the pull request and click Files
changed. Then, browse to the file that contains the code you want included in your
comment, and click View.
Choose whether to select a single line or a range.
○ To select a single line of code, click the line number to highlight the line.
○ To select a range of code, click the number of the first line in the range to highlight the line
of code. Then, hover over the last line of the code range, press Shift, and click the line
number to highlight the range.
To the left of the code range, click . In the dropdown menu, click Reference in new issue.
In the "Title" field, type a title for your issue.
In the comment body field, type a description of your issue.
If you're a project maintainer, you can assign the issue to someone, add it to a project,
associate it with a milestone, set the issue type, or apply a label.
When you're finished, click Submit new issue.
Reproducing a Reported Bug"

When a bug is reported, reproducing it means following a specific set of


steps to make the bug appear again. This helps confirm that the bug
exists and allows developers to understand the issue better.

Why is Reproducing a Bug Important?

1. Confirms the Bug Exists – Ensures it’s not a one-time glitch.


2. Helps Identify the Cause – Understanding when and how the bug appears.
3. Assists in Fixing It – Developers can test solutions by reproducing and
verifying fixes.
4. Prevents Future Issues – Once reproduced and fixed, similar problems can
be avoided.
Case Study: Reproducing and Fixing a Bug in a Simple Web App

Web App: Task Manager

A simple task manager built using HTML, CSS, JavaScript, and a Flask backend
allows users to add, delete, and update tasks.

Issue: Tasks Disappear After Page Refresh

Reported Bug:

● Users reported that newly added tasks disappear when the page is refreshed.

The issue was raised as a GitHub Issue:

Title: Tasks are not saved after refreshing the page

Description: When I add a task, it appears in the list. But after refreshing, all tasks disappear. Expected
behavior: Tasks should be saved and persist even after refresh.
Reproducing the Bug

Steps to Reproduce:

1. Open the Task Manager Web App.


2. Add a new task (e.g., "Complete GitHub Assignment").
3. Refresh the page.
4. Observe that the task is missing.

Expected Behavior:

● Tasks should persist after refreshing.

Actual Behavior:

● Tasks disappear after the page is reloaded.


Identifying the Root Cause

Bug Analysis:

● The frontend adds tasks to an array stored in JavaScript memory, not in a


database or local storage.
● When the page refreshes, the JavaScript memory is cleared, and tasks are lost.
● The backend API was not saving tasks properly in the database.

Code with the Bug (JavaScript)

let tasks = [];

function addTask(task) {
tasks.push(task);
updateUI();
}

● The tasks array is stored in memory, so it disappears when the page reloads.
Fixing the Issue
Solution:

● Store tasks persistently using LocalStorage in the frontend or a database in the backend.

Fixed Frontend Code (JavaScript)

function saveTasksToLocalStorage() {
localStorage.setItem("tasks", JSON.stringify(tasks));
}

function loadTasksFromLocalStorage() {
const storedTasks = localStorage.getItem("tasks");
if (storedTasks) {
tasks = JSON.parse(storedTasks);
}
}

function addTask(task) {
tasks.push(task);
saveTasksToLocalStorage();
updateUI();
}

// Load tasks when the page loads


loadTasksFromLocalStorage();
Verifying the Fix
Steps to Test the Fix:

1. Add a new task.


2. Refresh the page.
3. Check if the task persists.
4. Clear local storage or restart the server to ensure backend persistence works.

Expected Outcome After Fix:

✔ Tasks remain visible even after a page refresh.


✔ Tasks are retrieved from LocalStorage or backend database.
Testing a Pull Request (PR) in GitHub:

A Pull Request (PR) test in GitHub ensures that the proposed code changes fix a
reported bug without introducing new issues. Testing involves:
✔ Reviewing the changes.
✔ Running the code to verify the bug fix.
🛑 Simple Bug Issue

Issue Title:

🔴 Bug: Submit Button Not Working in Contact Form

Issue Description:

● The "Submit" button in the contact form does not work when clicked.
● Expected behavior: Clicking the button should display a success message.
● Actual behavior: Nothing happens when clicking the button.

🔄 Reproducing the Bug

Steps to Reproduce:

1. Open index.html in a browser.


2. Fill in the contact form.
3. Click the "Submit" button.
4. Observe that no response appears.
Identifying the Root Cause

Bug Analysis:

● The submit button is missing an event listener in JavaScript.


● The function handleSubmit() is defined but never called.

Buggy JavaScript Code (Before Fix)

function handleSubmit() {
alert("Form submitted successfully!");
}

Problem:

● The function exists but is not connected to the button click event.
🛠 Fixing the Issue

Fixed JavaScript Code

document.getElementById("submitBtn").addEventListener("click",
handleSubmit);

function handleSubmit() {
alert("Form submitted successfully!");
}

🔹 Fix:

● Added addEventListener() to call handleSubmit() when the button is clicked.


Testing the PR (Pull Request)

Steps to Test the Fix in GitHub:

1. Fork the repository and clone it locally.


2. Create a new branch (e.g., fix-submit-button).
3. Apply the fix in the script.js file.
4. Push changes and open a Pull Request (PR).
5. Test the PR by following these steps:
○ Checkout the branch locally.
○ Open index.html in a browser.
○ Fill in the form and click "Submit".
○ Confirm that the success message appears.

Expected Output After Testing:

✔ The form displays a success message when the button is clicked.


🛠 Steps to Create a Pull Request (PR) Using GitHub UI

Fork the Repository

1. Open the GitHub repository you want to contribute to.


2. Click the Fork button (top-right) to create a copy of the repository in your GitHub account.

Create a New Branch (Inside GitHub UI)

1. Go to your forked repository.


2. Click on the Branch dropdown (next to the repository name).
3. Type a new branch name, e.g., fix-submit-button.
4. Click Create branch
Edit the Code to Fix the Issue

1. Open the file where the bug exists (e.g., script.js).


2. Click the Edit (pencil icon) button on the top-right of the file.
3. Make the necessary changes (e.g., fixing the missing event listener).
4. Scroll down and add a commit message (e.g., "Fixed Submit button click event").
5. Select Commit directly to the fix-submit-button branch.
6. Click Commit changes.
Create a Pull Request (PR)
1. Navigate back to the main repository (not your fork).
2. Click the Pull Requests tab.
3. Click New Pull Request.
4. GitHub will show a comparison of branches:
○ Base repository → main branch of the original repository.
○ Head repository → Select your forked repo and fix-submit-button
branch.
5. Click Create Pull Request.
6. Add a title and description (explain what you fixed).
7. Click Create Pull Request again.
Review and Merge the PR (if approved)
1. Wait for repository maintainers to review your PR.
2. If needed, make changes based on feedback.
3. Once approved, the maintainer will merge your PR into the main branch.
def fibonacci_series(n):
fib_series = [0, 1]
for i in range(2, n):
fib_series.append(fib_series[i-1] + fib_series[i-2])
return fib_series

def is_palindrome(number):
return str(number) == str(number)[::-1]

# User input
num_terms = int(input("Enter the number of terms for Fibonacci series: "))
fib_series = fibonacci_series(num_terms)
print("Fibonacci Series:", fib_series)

num_to_check = int(input("Enter a number to check if it is a palindrome: "))


if is_palindrome(num_to_check):
print(f"{num_to_check} is a palindrome number.")
else:
print(f"{num_to_check} is not a palindrome number.")
def fibonacci_series(n):
fib_series = [0, 1]
for i in range(2, n):
fib_series.append(fib_series[i-1] + fib_series[i-2])
return fib_series[:n] # Return only 'n' elements

def is_palindrome(number):
return str(number) == str(number)[::-1]

# Welcome message
print("🔹🔹 Welcome to the Fibonacci and Palindrome Checker 🔹🔹\n")

while True:
print("\n Choose an option:")
print("1⃣ Generate Fibonacci Series")
print("2⃣ Check if a number is a Palindrome")
print("3⃣ Exit")

choice = input("\n Enter your choice (1/2/3): ")

if choice == '1':
num_terms = int(input("\nEnter the number of terms for Fibonacci series: "))
fib_series = fibonacci_series(num_terms)
print(f"📌 Fibonacci Series ({num_terms} terms):", fib_series)

elif choice == '2':


num_to_check = input("\nEnter a number to check if it is a palindrome: ")
if num_to_check.isdigit(): # Ensure input is a number
if is_palindrome(num_to_check):
print(f"✅ {num_to_check} is a palindrome!")
else:
print(f"❌ {num_to_check} is NOT a palindrome.")
else:
print("⚠ Please enter a valid number.")

elif choice == '3':


print("\n🔹 Thank you for using the program! Goodbye! 👋")
break

else:
print("⚠ Invalid choice! Please enter 1, 2, or 3.")
Managing Multiple Repositories Using Git (CLI)

Prerequisites
✔ Install Git (Download Git)
✔ Create a GitHub account (https://github.com/)
✔ Install Node.js (for backend) and React Native/Flutter (for mobile, if required)
Managing Multiple Repositories Using Git (CLI)

Workflow: Step-by-Step Guide Using Git


We will create three separate repositories for:

1⃣ Frontend (student-management-frontend)
2⃣ Backend (student-management-backend)
3⃣ Mobile (student-management-mobile)

Each project will be managed independently.


Managing Multiple Repositories Using Git (CLI)

Step 1: Create GitHub Repositories

1. Go to GitHub.
2. Click "+" (top-right corner) → New Repository.
3. Enter Repository Name:
○ Frontend: student-management-frontend
○ Backend: student-management-backend
○ Mobile: student-management-mobile
4. Choose Public or Private.
5. DO NOT initialize with README (we will create it later).
6. Click Create Repository.
7. Copy the repository URL for later use.
Step 2: Set Up the Repositories Locally Using Git

1. Cloning and Setting Up the Frontend Repository


2.
3. # Navigate to the working directory
4. cd ~/Projects # Change this to your preferred location
5.
6. # Clone the frontend repository from GitHub
7. git clone https://github.com/your-username/student-management-frontend.git
8.
9. # Navigate into the repository
10. cd student-management-frontend
11. # Initialize a React app (or add HTML/CSS files)
12. npx create-react-app .
13. # Stage, commit, and push the frontend code
14. git add .
15. git commit -m "Initial commit for frontend"
16. git push origin main
Step 2: Set Up the Repositories Locally Using Git

1. Cloning and Setting Up the Backend Repository


2. # Go back to the main directory
3. cd ~/Projects
4. # Clone the backend repository from GitHub
5. git clone https://github.com/your-username/student-management-backend.git
6. # Navigate into the repository
7. cd student-management-backend
8. # Initialize a Node.js project
9. npm init -y
10. # Install Express.js and other dependencies
11. npm install express mysql cors
12. # Create index.js for a simple API
13. echo "const express = require('express'); const app = express();
14. app.get('/', (req, res) => res.send('Backend is running'));
15. app.listen(3000, () => console.log('Server running on port 3000'));" > index.js
16. # Stage, commit, and push the backend code
17. git add .
18. git commit -m "Initial commit for backend"
19. git push origin main
Step 2: Set Up the Repositories Locally Using Git

1. Cloning and Setting Up the Mobile App Repository


2. # Go back to the main directory
3. cd ~/Projects
4. # Clone the mobile repository from GitHub
5. git clone https://github.com/your-username/student-management-mobile.git
6.
7. # Navigate into the repository
8. cd student-management-mobile
9.
10. # Initialize a React Native app (or use Flutter)
11. npx react-native init StudentManagementMobile
12.
13. # Stage, commit, and push the mobile code
14. git add .
15. git commit -m "Initial commit for mobile app"
16. git push origin main
Step 2: Set Up the Repositories Locally Using Git

1. Cloning and Setting Up the Mobile App Repository


2. # Go back to the main directory
3. cd ~/Projects
4. # Clone the mobile repository from GitHub
5. git clone https://github.com/your-username/student-management-mobile.git
6.
7. # Navigate into the repository
8. cd student-management-mobile
9.
10. # Initialize a React Native app (or use Flutter)
11. npx react-native init StudentManagementMobile
12.
13. # Stage, commit, and push the mobile code
14. git add .
15. git commit -m "Initial commit for mobile app"
16. git push origin main
How to Create and Switch Branches?

Step 3: Manage and Collaborate # Check existing branches


git branch
● Use branches to separate features (git checkout -b feature-name).
# Create a new branch (for example,
● Use GitHub Issues to track work. adding a login feature)
● Use Pull Requests (PRs) for merging changes. git checkout -b feature-login

# Switch to another branch


What is a Branch? git checkout main

A branch is a separate copy of the code where developers can work on # Push the new branch to GitHub
git push origin feature-login
new features or fixes without affecting the main (stable) codebase.

Why Use Branches?

✔ Prevents breaking the main code Once the feature is complete, it will be merged into the main branch
✔ Allows multiple developers to work in parallel using a Pull Request (PR).
✔ Keeps the main branch stable while testing new features
Example GitHub Issues:
Use GitHub Issues to Track Work
1. [Bug]: Student profiles not loading in the frontend.
What are GitHub Issues? 2. [Feature Request]: Add a "Forgot Password" feature.
3. [Enhancement]: Improve mobile responsiveness.
GitHub Issues allow teams to: ✔ Report bugs
✔ Suggest new features
✔ Discuss improvements
✔ Assign tasks to developers

How to Create an Issue?

1. Go to your repository on GitHub.


2. Click the "Issues" tab.
3. Click "New Issue".
4. Add:
○ A Title (e.g., "Fix backend API for student data").
○ A Description explaining the problem or feature request.
○ Labels (e.g., bug, enhancement, documentation).
○ Assign it to a developer.
5. Click "Submit new issue".

🔹 Once the issue is resolved, it can be closed.


Use Pull Requests (PRs) for Merging Changes How to Create a Pull Request?
Push your branch to GitHub:
What is a Pull Request (PR)?
git add .
A Pull Request (PR) is a request to merge code from a branch git commit -m "Added login functionality"
(feature-login) into the main branch (main). git push origin feature-login
It allows for code review and approval before changes go live.
1. Go to GitHub → Open your repository.
2. Click "Pull Requests" → Click "New Pull Request".
3. Select the base branch (main) and compare branch
(feature-login).
Example PR Workflow 4. Add a description explaining the changes.
5. Click "Create Pull Request".
1. Developer A creates feature-login branch and
6. A team member reviews and approves the PR.
codes the login feature.
7. Once approved, click "Merge Pull Request" to merge
2. Developer A submits a Pull Request to merge
the branch into main.
feature-login into main.
3. Developer B (Reviewer) checks the code and requests
changes if needed.
4. Once approved, the PR is merged into main.

You might also like