Thuta Learning
Git
ProjectsDevOps & ToolsBeginner

Project: Portfolio Website — Part 2 (Feature Branch)

GitLesson 22

What you'll walk away with

  • Apply Project: Portfolio Website — Part 2 (Feature Branch) in a real, hands-on project
  • Write and run your own code
  • Build out an entire project step by step

Let's think about it this way for a second

In real-world development, every new feature usually isn't built directly on the main branch — it's built on its own separate branch. In this section, we'll practice creating a branch, switching to it, and then merging it back into main. We'll also learn the workflow for connecting our local repository to a remote repository on GitHub and pushing to it. By the end of this stage, our project's history will include branches, merges, and remote syncs.

Let's build it for real

Create a new branch called feature/projects-section with git branch, then switch to it with git switch. Add a Projects section to index.html (a heading plus a list of 2-3 projects) and commit it. Switch back to the main branch and merge it back in with git merge feature/projects-section. Finally, create an empty repository on GitHub, connect it with git remote add origin, and push with git push -u origin main.

Code Example

bash
# Step 1: feature branch ဖန်တီးပြီး switch လုပ်ပါ
git branch feature/projects-section
git switch feature/projects-section

# Step 2: index.html ကို edit လုပ်ပြီး (Projects section ထည့်ပါ) commit လုပ်ပါ
git add index.html
git commit -m "Add projects section to homepage"

# Step 3: main branch ကို ပြန်သွားပြီး merge လုပ်ပါ
git switch main
git merge feature/projects-section

# Step 4: feature branch ကို ပြီးရင် ဖျက်နိုင်ပါတယ် (optional)
git branch -d feature/projects-section

# Step 5: GitHub remote ချိတ်ဆက်ပြီး push လုပ်ပါ
git remote add origin https://github.com/<your-username>/portfolio-site.git
git push -u origin main
You should see
Refreshing the GitHub repository page shows an index.html that includes the Projects section, along with the full commit history.

Try it in 5 minutes

Create a new branch called feature/about-section, add an About Me section, and practice merging it back into main (5 minutes).

A quick word of caution

Before merging, always double-check which branch you're currently on with git status — merging on the wrong branch can leave your history in a tangled mess.

Easy traps

  • Forgetting to merge into main while still on the feature branch, and running git merge from the feature branch itself instead of switching to main first with git switch main
  • Running git remote add origin with the wrong repository URL, which causes an error when you try to push (worth checking with git remote -v first)

Now try it yourself

Create a new branch called feature/about-section, add an About Me section, and practice merging it back into main (5 minutes).

You'll know it worked when: Refreshing the GitHub repository page shows an index.html that includes the Projects section, along with the full commit history.

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Project: Portfolio Website — Part 2 (Feature Branch) | Thuta Learning