commit 808306c454de24fc8f851dce51ae7640195b192f Author: Boris_P Date: Wed May 27 08:27:37 2026 +0000 Initial commit diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..822bbc9 Binary files /dev/null and b/.DS_Store differ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c5f3f6b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..abba1d0 --- /dev/null +++ b/README.md @@ -0,0 +1,329 @@ +# Git-Scavenger-Hunt + +# 🎯 Git Scavenger Hunt - Activity Guide + +## Overview + +Get set for some real Git action! This scavenger hunt will take you on an adventure through the wilds of branches, uncover the secrets of commits, and delve into the mysteries of pull requests and code reviews. + +Whether you're eyeing a career as a software engineer, want to contribute to open-source projects, or just love learning new skills, knowing your way around a version control platform like Gitea is a game-changer. + +--- + +## 📋 Prerequisites + +Before you start, make sure Git is installed on your computer: + +### Installation + +**Windows (PowerShell/CMD):** +- Download from [git-scm.com](https://git-scm.com) + +**Mac (Terminal):** +```bash +git --version +``` +If not installed, it will prompt you to install Xcode Command Line Tools. + +**Linux (Terminal):** +```bash +# Ubuntu/Debian +sudo apt install git + +# Fedora +sudo dnf install git +``` + +### Verify Installation +```bash +git --version +``` + +--- + +## 🚀 Getting Started + +### Step 1: Create Repository + +**Partner A:** +1. Navigate to the template repo: https://gitea.techshare.cc/admin/Git-Scavenger-Hunt.git +2. Use it to create a new repository for your team (look for "Use this template" or "Fork") +3. On the "Create a new repository" page: + - Select your account/owner + - Enter a name for the repository + - Click the button to create it + +### Step 2: Add Collaborator + +**Partner A:** +1. Go to the **Settings** tab or "Repository Settings" +2. Navigate to **Collaborators** or **Collaboration** +3. Search for your partner's Gitea username and add them + +**Partner B:** +1. Click your profile icon in the top-right corner +2. Go to your notification settings or check for pending invitations +3. Accept the invitation to join your partner's repo + +### Step 3: Clone Repository + +From the main page of your new repository, copy the HTTPS clone link. + +**Both Partners:** +```bash +# Navigate to where you want to store the project +cd ~/Desktop +# or any folder you prefer + +# Clone the repository +git clone + +# Enter the cloned directory +cd + +# Verify the clone worked +ls # Mac/Linux +dir # Windows PowerShell + +# Check Git status +git status # Shows you're on the main branch +``` + +--- + +## 🌿 Part 1: Creating Branches + +### What is a Branch? + +A **repository** (or "repo") is like a project's folder and contains all the project files and each file's revision history. Repositories can have multiple collaborators and can be either public or private. + +A **branch** is a separate line of development. You can use branches to isolate your work when you're developing a new feature or fixing a bug. + +### Create Your Branches + +**Partner A (in your terminal):** +```bash +# Create a new branch (replace 'your-branch-name' with something descriptive) +git checkout -b feature/add-student-method + +# Verify you are on the new branch +git branch + +# Push the new branch to the remote repository (Gitea) +git push -u origin feature/add-student-method +``` + +**Partner B (in your terminal):** +```bash +# First, pull the latest changes to see the new branch +git fetch + +# Create your own branch +git checkout -b bugfix/fix-syntax-error + +# Push your branch to the remote +git push -u origin bugfix/fix-syntax-error +``` + +### 💡 Branch Naming Best Practices + +Branch names help your team understand what is being worked on: + +- ✅ **Keep it short:** Branch names should be concise +- ✅ **Use dashes or slashes:** Separate words with dashes (`my-new-feature`) or slashes (`feature/my-new-feature`) +- ✅ **Use lowercase:** It's best to stick to lowercase, as Git is case-sensitive +- ✅ **Describe the work:** The name should give an idea of what the changes involve + +**Examples:** +- `feature/user-authentication` +- `bugfix/login-error` +- `docs/update-readme` +- `refactor/cleanup-code` + +--- + +## ✏️ Part 2: Making Changes + +Work together on **Partner B's computer** to make the following changes. + +### Delete a File + +```bash +# Find and delete the file (e.g., DeleteMe.java) +rm DeleteMe.java # Mac/Linux +del DeleteMe.java # Windows PowerShell + +# Check Git status to see what changed +git status +``` + +You should see the deleted file listed as a change. + +### Stage and Commit the Change + +```bash +# Stage the deletion (tell Git which changes to track) +git add DeleteMe.java + +# Commit the change with a message +git commit -m "removed unused DeleteMe.java file" + +# Push the commit to the remote repository +git push +``` + +### 💡 Understanding Git States + +A **commit** is an individual change to a file (or set of files). With Git, there are three key states that a file can be in: + +1. **Modified:** The file has been changed, but Git is not tracking these changes yet +2. **Staged** (`git add`): The changes you made are exactly what you want to include in the next commit +3. **Committed** (`git commit`): The version of the file has been safely saved in your local repo + +### Fix a Syntax Error + +Back in the code... There is a syntax error in one of the existing `.java` files. Find the error and fix it using any text editor (VS Code, Notepad++, nano, vim, etc.). + +```bash +# See which file changed +git status + +# Stage the fixed file +git add .java + +# Commit your fix +git commit -m "fixed syntax error in Student class" + +# Push to remote +git push +``` + +### Explore Your Repository + +Go to the repo on the **Gitea web interface**. Can you find your branches? + +💡 **Hint:** Look for a dropdown on the main page of the repo that says `main`. Click it to see the list of branches. + +--- + +## 🛑 Part 3: Stop & Reflect 🤔 + +Answer these questions in your notes or with your partner: + +1. **Why do you think it's important to create a new branch when making changes to the code, rather than making changes directly in the main branch?** + +2. **What does it mean to push your changes, and why is this an important step in using a version control system like Git?** + +--- + +## 🔀 Part 4: Open a Pull Request + +### What is a Pull Request? + +A **Pull Request** (sometimes called a Merge Request) is a method of submitting contributions to a project. It lets you notify others about changes you've pushed to a repository on Gitea. + +### Partner B: Create Pull Request + +1. Navigate to the repo on the Gitea web interface +2. Go to the **Pull Requests** tab +3. Click the **New Pull Request** button +4. Make sure you're merging to the correct branch: + - **Base:** Partner A's branch + - **Compare:** Your branch +5. Provide a title and a brief description for your pull request +6. Select **Partner A** as a reviewer + +### Partner A: Create Pull Request + +Now follow the same process to open a pull request to merge your branch into the `main` branch: + +1. Provide a title and a description +2. Select **Partner B** as the reviewer + +--- + +## 👀 Part 5: Reviewing the PR + +### Review Your Partner's Work + +1. Go to the **Pull Requests** tab in the Gitea web interface +2. Select your partner's pull request from the list +3. Click the **Files Changed** tab +4. Go through the changes line by line +5. For each change, click on the line number to add a comment about that specific line + +### Submit Your Review + +When you're done reviewing: + +1. Write a **summary comment** to give overall feedback about the changes +2. If you've found issues that need to be addressed, submit your review with a **request for changes** +3. If everything looks good, **approve** the pull request +4. On the **Conversation** tab, click the green button to **merge** the pull request +5. Click the **Delete branch** button after the merge is complete + +### 💡 Why Delete Branches? + +It is often recommended to delete the branch after merging. Branches are typically short-lived and topic-specific, so they aren't needed anymore once the work is merged. + +--- + +## 🛑 Part 6: Stop & Reflect 🤔 + +Answer these questions in your notes or with your partner: + +1. **Explain in your own words what a pull request is and why it's useful when collaborating on a codebase.** + +2. **How did it feel to receive feedback on your own code? How can you use this feedback to improve your coding skills?** + +--- + +## 📚 Bonus: Quick Git Commands Reference + +| Command | Description | +|---------|-------------| +| `git clone ` | Download a repository to your computer | +| `git branch` | List all branches | +| `git checkout -b ` | Create and switch to a new branch | +| `git checkout ` | Switch to an existing branch | +| `git status` | See what files have changed | +| `git add ` | Stage a file for commit | +| `git add .` | Stage all changed files | +| `git commit -m "message"` | Commit staged changes | +| `git push` | Push commits to remote repository | +| `git pull` | Pull latest changes from remote | +| `git fetch` | Download remote changes without merging | +| `git log --oneline` | View commit history | + +--- + +## 🎓 Learning Outcomes + +By completing this scavenger hunt, you will: + +- ✅ Understand how to create and manage branches +- ✅ Learn the Git workflow: modify → stage → commit → push +- ✅ Practice collaboration through pull requests and code reviews +- ✅ Gain hands-on experience with Gitea (or similar platforms like GitHub/GitLab) +- ✅ Develop best practices for version control in team environments + +--- + +## 💡 Tips for Success + +1. **Communicate with your partner** - Discuss your changes before committing +2. **Write clear commit messages** - Explain what changed and why +3. **Review code thoroughly** - Look for bugs, style issues, and improvements +4. **Be constructive with feedback** - Focus on the code, not the person +5. **Ask questions** - If something doesn't make sense, ask for clarification + +--- + +## 🔗 Additional Resources + +- [Git Official Documentation](https://git-scm.com/doc) +- [Pro Git Book](https://git-scm.com/book/en/v2) + +--- + +**Happy Coding! 🚀** diff --git a/assets/lesson1-01.png b/assets/lesson1-01.png new file mode 100644 index 0000000..c7005d2 Binary files /dev/null and b/assets/lesson1-01.png differ diff --git a/assets/lesson1-02.png b/assets/lesson1-02.png new file mode 100644 index 0000000..13ac891 Binary files /dev/null and b/assets/lesson1-02.png differ diff --git a/assets/lesson1-03.png b/assets/lesson1-03.png new file mode 100644 index 0000000..e520430 Binary files /dev/null and b/assets/lesson1-03.png differ diff --git a/assets/lesson1-04.png b/assets/lesson1-04.png new file mode 100644 index 0000000..f7746f1 Binary files /dev/null and b/assets/lesson1-04.png differ diff --git a/assets/lesson1-05.png b/assets/lesson1-05.png new file mode 100644 index 0000000..bd71bcd Binary files /dev/null and b/assets/lesson1-05.png differ diff --git a/assets/lesson1-06.png b/assets/lesson1-06.png new file mode 100644 index 0000000..58b5454 Binary files /dev/null and b/assets/lesson1-06.png differ diff --git a/assets/lesson1-07.png b/assets/lesson1-07.png new file mode 100644 index 0000000..482d170 Binary files /dev/null and b/assets/lesson1-07.png differ diff --git a/assets/lesson1-08.png b/assets/lesson1-08.png new file mode 100644 index 0000000..7325d3c Binary files /dev/null and b/assets/lesson1-08.png differ diff --git a/assets/lesson1-09.png b/assets/lesson1-09.png new file mode 100644 index 0000000..e6d6d52 Binary files /dev/null and b/assets/lesson1-09.png differ diff --git a/assets/lesson1-10.png b/assets/lesson1-10.png new file mode 100644 index 0000000..367c0b8 Binary files /dev/null and b/assets/lesson1-10.png differ diff --git a/assets/lesson1-11.png b/assets/lesson1-11.png new file mode 100644 index 0000000..c152a3d Binary files /dev/null and b/assets/lesson1-11.png differ diff --git a/assets/lesson1-12.png b/assets/lesson1-12.png new file mode 100644 index 0000000..e8ca2e9 Binary files /dev/null and b/assets/lesson1-12.png differ diff --git a/assets/lesson1-13.png b/assets/lesson1-13.png new file mode 100644 index 0000000..b0b58cb Binary files /dev/null and b/assets/lesson1-13.png differ diff --git a/assets/lesson1-14.png b/assets/lesson1-14.png new file mode 100644 index 0000000..abd7308 Binary files /dev/null and b/assets/lesson1-14.png differ diff --git a/assets/lesson1-15.png b/assets/lesson1-15.png new file mode 100644 index 0000000..876d498 Binary files /dev/null and b/assets/lesson1-15.png differ diff --git a/assets/lesson1-16.png b/assets/lesson1-16.png new file mode 100644 index 0000000..8654522 Binary files /dev/null and b/assets/lesson1-16.png differ diff --git a/assets/lesson1-17.png b/assets/lesson1-17.png new file mode 100644 index 0000000..0c7baaf Binary files /dev/null and b/assets/lesson1-17.png differ diff --git a/assets/lesson1-18.png b/assets/lesson1-18.png new file mode 100644 index 0000000..6515601 Binary files /dev/null and b/assets/lesson1-18.png differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..74d711d --- /dev/null +++ b/pom.xml @@ -0,0 +1,75 @@ + + + 4.0.0 + + com.csase + githubintro + 1.0 + + githubintro + + + UTF-8 + 17 + 17 + 17 + + + + + + org.junit + junit-bom + 5.9.1 + pom + import + + + + + + + + org.projectlombok + lombok + 1.18.24 + true + + + org.junit.jupiter + junit-jupiter + test + + + + org.junit.jupiter + junit-jupiter-params + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + maven-surefire-plugin + 2.22.2 + + + + diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..9d6a566 Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/main/.DS_Store b/src/main/.DS_Store new file mode 100644 index 0000000..55c1fcb Binary files /dev/null and b/src/main/.DS_Store differ diff --git a/src/main/java/.DS_Store b/src/main/java/.DS_Store new file mode 100644 index 0000000..35a54bf Binary files /dev/null and b/src/main/java/.DS_Store differ diff --git a/src/main/java/com/csase/Assignment.java b/src/main/java/com/csase/Assignment.java new file mode 100644 index 0000000..3e6b61c --- /dev/null +++ b/src/main/java/com/csase/Assignment.java @@ -0,0 +1,57 @@ +package com.csase; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +/* + * Represents an assignment with a name and due date + */ +public class Assignment { + + private String name; // name of assignment + private LocalDate dueDate; // due date of assignment + + /* + * Sets name and due date of assignment + */ + public Assignment(String name, LocalDate dueDate) { + this.name = name; + this.dueDate = dueDate; + } + + /* + * Returns name of assignment + */ + public String getName() { + return this.name; + } + + /* + * Returns due date of assignment + */ + public LocalDate getDueDate() { + return this.dueDate; + } + + /* + * Sets name of assignment + */ + public void setName(String name) { + this.name = name; + } + + /* + * Sets due date of assignment + */ + public void setDate(LocalDate dueDate) { + this.dueDate = dueDate; + } + + /* + * Returns string representation of assignment + */ + public String toString() { + return this.name + " (due: " + this.dueDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")) + ")"; + } + +} diff --git a/src/main/java/com/csase/DeleteMe.java b/src/main/java/com/csase/DeleteMe.java new file mode 100644 index 0000000..11ad3c4 --- /dev/null +++ b/src/main/java/com/csase/DeleteMe.java @@ -0,0 +1,9 @@ +package com.csase; + +public class DeleteMe { + + public void deleteMe() { + System.out.println("Delete me!"); + } + +} diff --git a/src/main/java/com/csase/PlannerRunner.java b/src/main/java/com/csase/PlannerRunner.java new file mode 100644 index 0000000..d689210 --- /dev/null +++ b/src/main/java/com/csase/PlannerRunner.java @@ -0,0 +1,13 @@ +package com.csase; + +public class PlannerRunner { + public static void main(String[] args) { + + // Create a new student + Student jada = new Student(); + + // Gets the student's choice until the student exits + jada.getChoice(); + + } +} diff --git a/src/main/java/com/csase/Student.java b/src/main/java/com/csase/Student.java new file mode 100644 index 0000000..66c709a --- /dev/null +++ b/src/main/java/com/csase/Student.java @@ -0,0 +1,63 @@ +package com.csase; + +import java.util.Scanner; + +/* + * Represents a student that with a study planner + */ +public class Student { + + private StudyPlanner planner; // study planner + private Scanner scanner; // scanner for user input + + /* + * Sets study planner and scanner + */ + public Student { + planner = new StudyPlanner(); + scanner = new Scanner(System.in); + } + + /* + * Gets the student's choice and runs it until the student exits + */ + public void getChoice() { + int option = -1; + + while (option != 3) { + System.out.println("Welcome to Study Planner!"); + System.out.println("What would you like to do?"); + System.out.println(planner.getOptions()); + System.out.print("Enter option: "); + option = scanner.nextInt(); + scanner.nextLine(); + runChoice(option); + } + } + + /* + * Runs the student's choice + */ + public void runChoice(int option) { + if (option == 1) { + addAssignment(); + } else if (option == 2) { + System.out.println(planner.listAssignments()); + } else if (option == 3) { + System.out.println("Goodbye!"); + } else { + System.out.println("Invalid option!"); + } + } + + /* + * Adds a new assignment to the study planner + */ + public void addAssignment() { + System.out.print("Enter assignment name: "); + String name = scanner.nextLine(); + System.out.print("Enter due date (YYYY-MM-DD): "); + String dueDate = scanner.nextLine(); + planner.addAssignment(name, dueDate); + } +} diff --git a/src/main/java/com/csase/StudyPlanner.java b/src/main/java/com/csase/StudyPlanner.java new file mode 100644 index 0000000..be74d88 --- /dev/null +++ b/src/main/java/com/csase/StudyPlanner.java @@ -0,0 +1,67 @@ +package com.csase; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; + +/* + * Represents a study planner with a list of assignments + */ +public class StudyPlanner { + + private ArrayList assignments; // list of assignments + private String[] options; // list of options + + /* + * Sets assignments and options + */ + public StudyPlanner() { + assignments = new ArrayList(); + options = new String[]{"1. Add Assignment", "2. List Assignments", "3. Exit"}; + } + + /* + * Returns list of assignments + */ + public ArrayList getAssignments() { + return assignments; + } + + /* + * Adds a new assignment to the list of assignments + */ + public void addAssignment(String name, String dueDateString) { + LocalDate dueDate = LocalDate.parse(dueDateString, DateTimeFormatter.ISO_LOCAL_DATE); + assignments.add(new Assignment(name, dueDate)); + } + + /* + * Returns string representation of assignments + */ + public String listAssignments() { + String assignmentsString = ""; + + if (assignments.size() == 0) { + return "No assignments to list!\n"; + } + + for (Assignment assignment : assignments) { + assignmentsString += assignment.toString() + "\n"; + } + + return assignmentsString; + } + + /* + * Returns string representation of options + */ + public String getOptions() { + String optionsString = ""; + + for (String option : options) { + optionsString += option + "\n"; + } + + return optionsString; + } +} diff --git a/target/classes/com/csase/Assignment.class b/target/classes/com/csase/Assignment.class new file mode 100644 index 0000000..417f714 Binary files /dev/null and b/target/classes/com/csase/Assignment.class differ diff --git a/target/classes/com/csase/DeleteMe.class b/target/classes/com/csase/DeleteMe.class new file mode 100644 index 0000000..dc699dd Binary files /dev/null and b/target/classes/com/csase/DeleteMe.class differ diff --git a/target/classes/com/csase/PlannerRunner.class b/target/classes/com/csase/PlannerRunner.class new file mode 100644 index 0000000..db6482a Binary files /dev/null and b/target/classes/com/csase/PlannerRunner.class differ diff --git a/target/classes/com/csase/Student.class b/target/classes/com/csase/Student.class new file mode 100644 index 0000000..e0aece0 Binary files /dev/null and b/target/classes/com/csase/Student.class differ diff --git a/target/classes/com/csase/StudyPlanner.class b/target/classes/com/csase/StudyPlanner.class new file mode 100644 index 0000000..e7c8be6 Binary files /dev/null and b/target/classes/com/csase/StudyPlanner.class differ