Skip
Arish's avatar

44. Git and GitHub Project - Task 5


Project Task 5: Complete PR Workflow

Practice a full pull request workflow including assignment, review, and merge.

Objective

Execute a complete PR workflow from issue to merge.

Part 1: Set Up the Issue

Step 1: Create a New Issue

On GitHub, create an issue:

Title: Add responsive navigation menu

Description:

markdown
1## Feature Request
2Make navigation responsive for mobile devices.
3
4## Requirements
5- [ ] Hamburger menu icon on mobile
6- [ ] Slide-out menu
7- [ ] Smooth animations
8
9## Design Notes
10- Menu icon appears below 768px
11- Menu slides from right
12- Close button in menu
13
14## Acceptance Criteria
15- Works on all mobile devices
16- Animations are smooth
17- Menu closes when clicking outside

Add labels: enhancement, mobile

Step 2: Assign Yourself

  1. Click Assignees
  2. Select your username
  3. You're now responsible!

Part 2: Create the PR

Step 3: Create Branch

bash
1cd portfolio-project
2git checkout main
3git pull origin main
4git checkout -b feature/responsive-nav

Step 4: Implement Changes

Update css/style.css:

css
1/* Mobile Navigation */
2@media (max-width: 768px) {
3    header nav {
4        display: none;
5        position: fixed;
6        top: 0;
7        right: 0;
8        width: 250px;
9        height: 100vh;
10        background: #222;
11        padding: 60px 20px;
12        transform: translateX(100%);
13        transition: transform 0.3s ease;
14    }
15
16    header nav.active {
17        display: block;
18        transform: translateX(0);
19    }
20
21    header nav a {
22        display: block;
23        margin: 20px 0;
24        font-size: 1.2rem;
25    }
26
27    .menu-toggle {
28        display: block;
29        background: none;
30        border: none;
31        color: white;
32        font-size: 1.5rem;
33        cursor: pointer;
34    }
35
36    .menu-close {
37        position: absolute;
38        top: 20px;
39        right: 20px;
40        font-size: 1.5rem;
41        color: white;
42        background: none;
43        border: none;
44        cursor: pointer;
45    }
46}
47
48@media (min-width: 769px) {
49    .menu-toggle,
50    .menu-close {
51        display: none;
52    }
53}

Update index.html header:

html
1<header>
2    <h1>Welcome to My Portfolio</h1>
3    <button class="menu-toggle" onclick="toggleMenu()"></button>
4    <nav id="main-nav">
5        <button class="menu-close" onclick="toggleMenu()">×</button>
6        <a href="#about">About</a>
7        <a href="#skills">Skills</a>
8        <a href="#projects">Projects</a>
9        <a href="#contact">Contact</a>
10    </nav>
11</header>

Update js/main.js:

javascript
1// Mobile menu toggle
2function toggleMenu() {
3    const nav = document.getElementById('main-nav');
4    nav.classList.toggle('active');
5}
6
7// Close menu when clicking outside
8document.addEventListener('click', function(event) {
9    const nav = document.getElementById('main-nav');
10    const toggle = document.querySelector('.menu-toggle');
11    
12    if (!nav.contains(event.target) && !toggle.contains(event.target)) {
13        nav.classList.remove('active');
14    }
15});

Step 5: Commit and Push

bash
1git add .
2git commit -m "Add responsive navigation menu
3
4- Add hamburger menu for mobile
5- Implement slide-out navigation
6- Add click-outside to close
7
8Closes #3"
9
10git push -u origin feature/responsive-nav

Part 3: Create and Complete PR

Step 6: Create Pull Request

On GitHub:

Title: Add responsive navigation menu

Description:

markdown
1## Description
2Implement responsive navigation for mobile devices.
3
4## Changes
5- Added hamburger menu button
6- Created slide-out navigation panel
7- Added smooth CSS transitions
8- Implemented click-outside to close
9
10## Testing
111. Open site on desktop - normal navigation
122. Resize to < 768px - hamburger appears
133. Click hamburger - menu slides out
144. Click outside or × - menu closes
15
16## Screenshots
17[Add mobile and desktop screenshots]
18
19## Checklist
20- [x] Tested on mobile
21- [x] Animations smooth
22- [x] Closes #3
23
24Closes #3

Step 7: Self-Review

  1. Go to Files changed tab
  2. Review each file
  3. Leave comments on your own code:
    • Good practices
    • Things to improve later

Step 8: Request Review (If Team)

If working with others:

  1. Click Reviewers
  2. Select teammates

Step 9: Merge the PR

  1. Verify all checks pass
  2. Click Squash and merge
  3. Edit commit message if needed
  4. Click Confirm squash and merge
  5. Click Delete branch

Part 4: Clean Up

Step 10: Update Local

bash
1git checkout main
2git pull origin main
3git branch -d feature/responsive-nav

Step 11: Verify

  1. Check issue #3 is closed
  2. View commits on main
  3. Test the responsive nav

Bonus: Set Up Branch Protection

Configure protection for main branch:

  1. Settings → Branches
  2. Add rule for main
  3. Enable:
    • Require PR before merging
    • Require 1 approval (if team)
    • Require status checks
  4. Save changes

Verification Checklist

  • Issue created and assigned
  • Feature branch created
  • Changes implemented
  • PR created with good description
  • Code reviewed (self or team)
  • PR merged (squash)
  • Branch deleted
  • Issue auto-closed
  • Local repo updated

Summary

You've completed a full workflow:

  • ✅ Issue → Branch → Commits → PR → Review → Merge
  • ✅ Proper assignment and tracking
  • ✅ Code review process
  • ✅ Clean merge with squash
  • ✅ Branch cleanup

Next: Learn about advanced branching concepts!