2026-05-14 11:48:43 +00:00
2026-05-14 11:48:43 +00:00

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):

Mac (Terminal):

git --version

If not installed, it will prompt you to install Xcode Command Line Tools.

Linux (Terminal):

# Ubuntu/Debian
sudo apt install git

# Fedora
sudo dnf install git

Verify Installation

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:

# Navigate to where you want to store the project
cd ~/Desktop
# or any folder you prefer

# Clone the repository
git clone <paste-the-https-link-you-copied>

# Enter the cloned directory
cd <your-repository-name>

# 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):

# 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):

# 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

# 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

# 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.).

# See which file changed
git status

# Stage the fixed file
git add <filename>.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 <url> Download a repository to your computer
git branch List all branches
git checkout -b <name> Create and switch to a new branch
git checkout <name> Switch to an existing branch
git status See what files have changed
git add <file> 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


Happy Coding! 🚀

Description
No description provided
Readme 374 KiB
Languages
Java 100%