Skip to content

Nikunj-Java/Sql_Exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Collaboration Game – 2 Person Activity

This repository is a hands-on Git learning activity designed for 2 participants to practice real-world Git collaboration concepts such as branching, merging, conflicts, pull requests, and git stash.


👥 Roles

  • Person A → Developer
  • Person B → Team Lead / Repository Owner

📌 Assumptions

  • Repository name: fintech-app
  • Default branch: main
  • Both users have:
    • Git installed
    • GitHub / GitLab accounts

🎯 Learning Objectives

By completing this activity, learners will understand:

  • Repository collaboration
  • Clone, pull, and push workflow
  • Feature branches
  • Merge conflicts and resolution
  • Pull Request (PR) flow
  • Using git stash for urgent interruptions

🧩 Phase 1 — Project Birth

Step 1: Developer A creates project locally

mkdir fintech-app
cd fintech-app
echo "FinTech App - Initial Version" > README.md
echo "console.log('Hello FinTech');" > app.js
git init
git add .
git commit -m "Initial local project setup"

Step 2: Team Lead B creates remote repository

Create a repository named fintech-app on GitHub/GitLab.

Step 3: B adds A as collaborator

Step 4: A pushes code to remote

git remote add origin https://github.com/b/fintech-app.git
git branch -M main
git push -u origin main

🔁 Phase 2 — Clone & Sync

Step 5: B clones the repository

git clone https://github.com/b/fintech-app.git
cd fintech-app

🤝 Phase 3 — Basic Collaboration

Step 6: B makes a change

echo "// Added by B" >> app.js
git add app.js
git commit -m "B added comment"
git push

Step 7: A pulls latest changes

git pull

🌱 Phase 4 — Feature Branch Workflow

Step 8: A creates feature branch

git checkout -b feature-login
echo "Login feature by A" > feature-login.txt
git add .
git commit -m "Added login feature"
git push -u origin feature-login

Step 9: B merges feature branch

git checkout main
git pull
git merge origin/feature-login
git push

⚔️ Phase 5 — Merge Conflict Scenario

Step 10: Both edit the same line

A edits and pushes:

sed -i '2s/.*/Line 2 updated by A/' README.md
git add README.md
git commit -m "A updated README"
git push

B edits without pulling:

sed -i '2s/.*/Line 2 updated by B/' README.md
git add README.md
git commit -m "B updated README"
git pull

Step 11: Resolve conflict

Edit file to:

Line 2 updated by A and B

Then:

git add README.md
git commit -m "Resolved merge conflict"
git push

🔀 Phase 6 — Pull Request Flow

Step 12: A creates bug-fix branch

git checkout -b bug-fix
echo "// Bug fixed by A" >> app.js
git add app.js
git commit -m "Bug fix"
git push -u origin bug-fix

Step 13: Pull Request

Create PR from bug-fixmain and merge after review.


📦 Phase 7 — Git Stash Story

Step 14: A stashes work

echo "Feature work by A" >> app.js
echo "Temp notes" > temp.txt
git stash
git stash list

Step 15: A fixes urgent issue

git checkout -b hotfix-payment
echo "// Hotfix applied" >> app.js
git add app.js
git commit -m "Payment hotfix"
git push -u origin hotfix-payment

Step 16: A restores stashed work

git checkout main
git pull
git stash pop

🧠 Core Git Commands Covered

git clone
git pull
git push
git checkout -b
git merge
git stash
git stash pop

📄 License

This project is for educational and training purposes only.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published